/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 332.0 KiB
#2 Wrong Answer 3ms 588.0 KiB
#3 Wrong Answer 2ms 588.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'

void solve()
{
    int n,k; cin >> n >> k;
    string arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    string ans = "0";
    for (int i = 0; i < n-k; i++) {
        string s = arr[i]+arr[i+1]+arr[i+2];
        //cout << s << endl;
        if (ans.size() < s.size()) {
            ans = s;
        }
        else if (ans.size() == s.size()) {
            for (int j = 0; j < ans.size(); j++) {
                if (s[j] > ans[j]) {
                    ans = s;
                    break;
                }
                else if (ans[j] > s[j]) {
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

int32_t main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1; cin >> t;
    while(t--) solve();
    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:44:16
Judged At
2024-11-11 03:14:06
Judged By
Score
5
Total Time
3ms
Peak Memory
588.0 KiB