/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 5ms 3.004 MiB
#3 Accepted 4ms 2.52 MiB
#4 Accepted 6ms 2.566 MiB
#5 Accepted 5ms 2.566 MiB
#6 Accepted 5ms 2.562 MiB
#7 Wrong Answer 5ms 2.562 MiB
#8 Wrong Answer 3ms 576.0 KiB

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-11-11 03:15:23
Judged By
Score
30
Total Time
6ms
Peak Memory
3.004 MiB