/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 7ms 2.977 MiB
#3 Accepted 6ms 2.754 MiB
#4 Accepted 6ms 2.562 MiB
#5 Accepted 5ms 2.539 MiB
#6 Accepted 5ms 2.707 MiB
#7 Wrong Answer 5ms 2.473 MiB
#8 Wrong Answer 3ms 508.0 KiB
#9 Wrong Answer 2ms 484.0 KiB
#10 Wrong Answer 5ms 2.496 MiB
#11 Wrong Answer 2ms 320.0 KiB
#12 Wrong Answer 3ms 832.0 KiB
#13 Wrong Answer 3ms 836.0 KiB
#14 Wrong Answer 2ms 788.0 KiB
#15 Wrong Answer 3ms 2.648 MiB

Code

/*
**************************************************************
*Bis'Millah Hir Rah'Manir Rahim == start with the name of \n *
*                    ALLAH Subhana Tayala                    *
*                Author: Md. Mahabubar Rahman                *
*               CSE,RPI && Rangpur, Bangladesh               *
**************************************************************
*/
#include <bits/stdc++.h>
using namespace std;
#define Allhamdulillah 0
#define pb(x) push_back(x)
#define pp() pop_back()
#define ll long long int
#define foi(i, s, e) for (int i = s; i < e; i++)
#define cn(x) cin >> x
#define endl '\n'
#define Endl '\n'
#define nl cout << '\n'
#define yes cout << "YES\n"
#define no cout << "NO\n"

int sss(int n){
    string s=to_string(n);
    return s.size();
}
void solve()
{
    int n,k;cin>>n>>k;int arr[n];for(auto &c:arr)cin>>c;
    vector<string>ans;  
    string s="",s2;
    for(int i=0;i<=k;i++)s+=to_string(arr[i]);
    int start=1,j=k+1;
    ans.push_back(s);
    while(j<n){
        s+=to_string(arr[j]);
        int dlt=sss(arr[start-1]),tt=s.size();
        s2=s.substr(dlt,tt-dlt);
        ans.push_back(s2);
        s=s2;
        start++;
        j++;
    }
    sort(ans.begin(),ans.end(),greater<string>());
    cout<<ans[0]<<endl;
}
/*mdmahabub55*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t = 1;
    cin >> t;
    // t = 1;

    while (t--)
    {
        solve();
    }
    return Allhamdulillah;
}

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:15:37
Judged At
2024-10-03 13:27:52
Judged By
Score
30
Total Time
7ms
Peak Memory
2.977 MiB