/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 12ms 4.062 MiB
#3 Accepted 12ms 4.059 MiB
#4 Accepted 12ms 4.277 MiB
#5 Accepted 12ms 4.098 MiB
#6 Accepted 12ms 4.102 MiB
#7 Accepted 12ms 3.742 MiB
#8 Accepted 2ms 576.0 KiB
#9 Accepted 2ms 324.0 KiB
#10 Accepted 12ms 4.594 MiB
#11 Accepted 2ms 320.0 KiB
#12 Accepted 5ms 864.0 KiB
#13 Accepted 6ms 1.066 MiB
#14 Accepted 5ms 984.0 KiB
#15 Accepted 11ms 2.695 MiB

Code

// #include <bits/stdc++.h>
// #define int long long
// #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
// #define YN(ans) ans?cout<<"YES"<<endl:cout<<"NO"<<endl;
// #define vin(a,n) vector<int>a(n);for(auto &x:a)cin>>x;
// #define st(v,x) x==0?sort(v.begin(),v.end()):sort(v.rbegin() , v.rend());
// #define vout(a) for(auto x:a){cout<<x<<' ';}cout<<"\n";
// using namespace std;
// const int mod=1e9+7;
// struct node{
//     int b,r,g,y;
// };

// void solved_by_RAFIQ(){
//     int n,m;cin>>n>>m;
//     vector<node>vs(n+1);
//     vector<string>vss(n+1);
//     vs[0].b=vs[0].r=vs[0].g=vs[0].y=0;
//     map<pair<char,int>,int>mpb;
//     vector<vector<int>>vv(n+1);
//     for(int i=0;i<n;i++){
//         string s;cin>>s;vss[i+1]=s;
//         vs[i+1].b=vs[i].b+s.find("B")?1:0;
//         vs[i+1].r=vs[i].r+s.find("R")?1:0;
//         vs[i+1].g=vs[i].g+s.find("G")?1:0;
//         vs[i+1].y=vs[i].y+s.find("Y")?1:0;
//         // vv[i+1][s[0]]=vv[i][s[0]]+
//         if(vs[i+1].b>vs[i].b)mpb[{'B',vs[i+1].b}]=i;
//         if(vs[i+1].r>vs[i].r)mpb[{'R',vs[i+1].r}]=i;
//         if(vs[i+1].g>vs[i].g)mpb[{'G',vs[i+1].g}]=i;
//         if(vs[i+1].y>vs[i].y)mpb[{'Y',vs[i+1].y}]=i;
//     }
//     while(m--){
//         int x,y;cin>>x>>y;
//         int ans=-1;
//         for(int i=1;i<3;i++){
//             if(mpb[{vss[x][i-1],}])
//         }
//     }

// }


// signed main(){
//     fastio
//     int test_case=1,n=1;cin>>test_case;
//     while (test_case--){
//         //cout<< "Case "<<n<<": ";n++;
//         solved_by_RAFIQ();
//     }
// }

#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define YN(ans) ans?cout<<"YES"<<endl:cout<<"NO"<<endl;
#define vin(a,n) vector<int>a(n);for(auto &x:a)cin>>x;
#define st(v,x) x==0?sort(v.begin(),v.end()):sort(v.rbegin() , v.rend());
#define vout(a) for(auto x:a){cout<<x<<' ';}cout<<"\n";
using namespace std;
const int mod=1e9+7;

void solved_by_RAFIQ(){
    int n,k;cin>>n>>k;vin(v,n);//st(v,1);
    vector<string>vs(n);
    
    for(int j=0;j+k<n;j++){
        for(int i=j;i-j<=k;i++)vs[j]+=(to_string(v[i]));
    }
    string ans;
    int pre=0;
    for(auto it:vs){
        if(it.size()>pre)ans=it,pre=it.size();
        else if(it.size()==pre){
            ans = max(ans, it);
        }
    }
    cout<<ans<<endl;
}


signed main(){
    fastio
    int test_case=1,n=1;cin>>test_case;
    while (test_case--){
        //cout<< "Case "<<n<<": ";n++;
        solved_by_RAFIQ();
    }
}

Information

Submit By
Type
Submission
Problem
P1083 Number concatenation
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 19:13:19
Judged At
2024-10-03 13:20:14
Judged By
Score
100
Total Time
12ms
Peak Memory
4.594 MiB