CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:Senpai
Submission time:2016-10-16 22:34:45 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.42 s1details
#20.43 s1details
#31.33 s1details
#40.47 s1details
#50.47 s1details
#60.42 s2details
#70.43 s2details
#8--2details
#90.87 s2details
#101.33 s2details
#110.43 s3details
#120.43 s3details
#13--3details
#14--3details
#15--3details

Code

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

long long a,b,n,x,y;
vector<long long>s;
 vector<long long> v;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
    cin >> n;
  for(int i=0; i<n;i++){
      cin>>b;
      v.push_back(b);   
  }
     while(n!=0){
         if(v[0]==1){
             if(is_sorted(v.begin(),v.end()))
                break;
         }
         int k=0;
    if (v[0]==n){
        for(int i=n-1; i>=0; i--){
            x=i;
            if(abs(v[i]-v[i-1])!=1 && i!=0) {
               
                s.push_back(i);
                reverse(v.begin(),v.begin()+i);
                break;
 
         }
           else{
           s.push_back(n);
               reverse(v.begin(),v.begin()+i);
               a++;
                break;
               
           }  
             
         
            }
           
        
      if(a==1){
          break;
      }
    }
else if(v[1]==v[0]+1){
             while(v[k+2]!=v[0]-1 && k!=n-1){k++;}
             s.push_back(k+2);
             reverse(v.begin(),v.begin()+(k+2));

         }
          else if(v[1]!=v[0]+1){
                 while(v[k+1]!=v[0]+1 && k!=n-1){k++;}
                 s.push_back(k+1);
                 reverse(v.begin(),v.begin()+(k+1));
 
         }
            
            
         else {a=a;

         }
         
     }
      y=s.size();
cout<<y<<"\n";
for(int i=0; i<y;i++){
    cout<<s[i]<<" ";
     }
}

Test details

Test 1

Group: 1

Verdict:

input
1AAAAAAAAAAAAAAAAAAAA

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 2

Group: 1

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 3

Group: 1

Verdict:

input
20A

correct output
AAAAAAAAAAAAAAAAAAAA

user output
(empty)

Test 4

Group: 1

Verdict:

input
2N1J2F1XH2D2B2VT1N1ES

correct output
NNJFFXHDDBBVTVTNES

user output
(empty)

Test 5

Group: 1

Verdict:

input
2Z1E1UN1P2A2A1D2F2EZ1FZ1J

correct output
ZZEUNPAAAADFFEZEZFZJ

user output
(empty)

Test 6

Group: 2

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 7

Group: 2

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 8

Group: 2

Verdict:

input
1000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 9

Group: 2

Verdict:

input
11QOUDQFAFUPAYCPXZ15KANCLRGT9S...

correct output
QOUDQFAFUPAYCPXZQOUDQFAFUPAYCP...

user output
(empty)

Test 10

Group: 2

Verdict:

input
20NFBIUXOSO10XRXZRMULZDUFK14BB...

correct output
NFBIUXOSONFBIUXOSONFBIUXOSONFB...

user output
(empty)

Test 11

Group: 3

Verdict:

input
1AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 12

Group: 3

Verdict:

input
1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A...

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 13

Group: 3

Verdict:

input
1000000A

correct output
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

user output
(empty)

Test 14

Group: 3

Verdict:

input
87GEIGDBZCYGSFYYCGQUAWQJFUUAQG...

correct output
GEIGDBZCYGSFYYCGQUAWQJFUUAQGDT...

user output
(empty)

Test 15

Group: 3

Verdict:

input
316XXYCLTBFQRAXHQPTLDB275NMQJD...

correct output
XXYCLTBFQRAXHQPTLDBXXYCLTBFQRA...

user output
(empty)