/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 26ms 5.258 MiB
#3 Accepted 24ms 4.684 MiB
#4 Wrong Answer 25ms 4.848 MiB
#5 Accepted 23ms 4.668 MiB
#6 Wrong Answer 23ms 4.828 MiB
#7 Wrong Answer 26ms 5.168 MiB
#8 Wrong Answer 4ms 576.0 KiB
#9 Wrong Answer 3ms 324.0 KiB
#10 Wrong Answer 22ms 4.375 MiB
#11 Wrong Answer 2ms 324.0 KiB
#12 Wrong Answer 6ms 804.0 KiB
#13 Wrong Answer 21ms 1.883 MiB
#14 Wrong Answer 12ms 980.0 KiB
#15 Wrong Answer 20ms 3.957 MiB

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
      long long n,k;
      cin>>n>>k;
      vector<long long>v(n);
      for(int i=0;i<n;i++)
      {
          cin>>v[i];
      }

      vector<string>ans;


      for(int i=0;i<n;i++)
      {
          int l=i-1;
          int r=i+1;
          string temp=to_string(v[i]);

          long long op=0;
          while(true)
          {
              long long maxxl=-1;
              long long maxxr=-1;
              if(op>=k)
                break;

                if(l>=0)
                {
                    maxxl=v[l];
                    //l--;
                }

                if(r<=n-1)
                {
                    maxxr=v[r];
                    //r++;
                }

                long long p=max(maxxl,maxxr);

                if(p==-1)
                    break;

                    if(p==maxxl)
                        l--;
                    else if(p==maxxr)
                        r++;


                string hey=to_string(p);
                temp+=hey;

                // if(i==2)
           // cout<<temp<<endl;


              op++;
          }



          ans.push_back(temp);
      }


      sort(ans.begin(),ans.end());
      reverse(ans.begin(),ans.end());

      cout<<ans[0]<<endl;




    }
}

Information

Submit By
Type
Submission
Problem
P1083 Number concatenation
Contest
Bangladesh 2.0
Language
C++11 (G++ 13.2.0)
Submit At
2024-08-16 16:09:19
Judged At
2024-10-03 13:28:25
Judged By
Score
20
Total Time
26ms
Peak Memory
5.258 MiB