/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 536.0 KiB
#2 Accepted 8ms 2.984 MiB
#3 Accepted 7ms 2.562 MiB
#4 Wrong Answer 9ms 2.723 MiB
#5 Accepted 7ms 2.715 MiB
#6 Accepted 9ms 2.68 MiB
#7 Wrong Answer 7ms 2.535 MiB
#8 Wrong Answer 3ms 592.0 KiB
#9 Wrong Answer 2ms 484.0 KiB
#10 Wrong Answer 8ms 2.625 MiB
#11 Wrong Answer 3ms 328.0 KiB
#12 Wrong Answer 5ms 832.0 KiB
#13 Wrong Answer 6ms 988.0 KiB
#14 Wrong Answer 6ms 852.0 KiB
#15 Wrong Answer 8ms 2.645 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pe(c) for (auto &e : c) cout << e << ' '; cout << '\n'
#define ps(b) cout << (b ? "YES" : "NO") << '\n'
#define pc cout << "Case " << tc << ": "
#ifdef LOCAL
#include "def.h"
#else
#define ck(...)
#endif
const ll M = 1e9 + 7, N = 2e3 + 5;

void test(int tc) {
	ll a = 0, b = 0, n = 0, c = 0, d = 0, i = 0, j = 0, k = 0, q = 0;
	cin >> n >> k; k++;
	string ar[n];
    for(i=0;i<n;++i) {
        cin >> ar[i];
        // pre[i+1] = pre[i] + ar[i].size();
    }
    vector<string> s;
    for(i=0;i+k<=n;++i){
        string r;
        a = k;
        for(j=i;a--;++j){
            r+=ar[j];
        }
        s.push_back(r);
    }
    string r;
    for(i=n-k+1;i<n;++i) r+=ar[i];
    s.push_back(r);
    // for(auto e:s) cout << e << ' '; cout << endl;
    r='0';
    for(auto &e:s) r=max(r, e);
    cout << r;
 	cout << '\n';
}

signed main() {
	cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit|cin.badbit);
	int tc = 0, t = 1;
	cin >> t;
	while (tc < t) test(++tc);
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1083 Number concatenation
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 16:27:21
Judged At
2024-10-03 13:26:52
Judged By
Score
25
Total Time
9ms
Peak Memory
2.984 MiB