Submission #598474

# Submission time Handle Problem Language Result Execution time Memory
598474 2022-07-18T11:42:05 Z mosiashvililuka Ancient Machine (JOI21_ancient_machine) C++17
70 / 100
66 ms 8356 KB
#include<bits/stdc++.h>
#include "Anna.h"
using namespace std;
void Anna(int NN, std::vector<char> SS) {
    int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
    vector <int> f(100009);
    a=NN;
    for(i=1; i<=a; i++){
        if(SS[i-1]=='X') f[i]=0;
        if(SS[i-1]=='Y') f[i]=1;
        if(SS[i-1]=='Z') f[i]=2;
    }

    /*for(i=1; i<=a; i++){
        if(f[i]==0){
            Send(0);Send(0);
        }
        if(f[i]==1){
            Send(1);Send(0);
        }
        if(f[i]==2){
            Send(1);Send(1);
        }
    }*/
    //
    for(i=1; i<=a; i++){
        if(f[i]==0){
            break;
        }
        Send(0);
    }
    if(i>a) return;
    I=i;ii=i;
    Send(1);
    for(i=I+1; i<=a; i++){
        if(f[i]==2){
            /*for(j=i-1; j>ii; j--){
                rem(j);
            }
            rem(i);
            ii=i;
            continue;*/
            Send(1);
        }else{
            Send(0);
        }
    }
    //for(i=a; i>ii; i--) rem(i);
    //rem(I);
}
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;
namespace {
void rem(int q){
    Remove(q-1);
}
}
void Bruno(int NN, int LL, std::vector<int> AA) {
    int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
    vector <int> f(100009);
    a=NN;L=LL;
    for(i=1; i<=a; i++){
        /*ii=i*2-2;jj=i*2-1;
        if(AA[ii]==1) f[i]++;
        if(AA[jj]==1) f[i]++;*/
        f[i]=AA[i-1];
    }
    /*for(i=1; i<=a; i++){
        if(f[i]==0){
            break;
        }
        rem(i);
    }
    if(i>a) return;
    I=i;ii=i;
    for(i=I+1; i<=a; i++){
        if(f[i]==2){
            for(j=i-1; j>ii; j--){
                rem(j);
            }
            rem(i);
            ii=i;
            continue;
        }
    }
    for(i=a; i>ii; i--) rem(i);
    rem(I);*/
    for(i=1; i<=a; i++){
        if(f[i]==1){
            break;
        }
        rem(i);
    }
    if(i>a) return;
    I=i;ii=i;
    for(i=I+1; i<=a; i++){
        if(f[i]==1){
            for(j=i-1; j>ii; j--) rem(j);
            rem(i);
            ii=i;
            continue;
        }
    }
    for(i=a; i>ii; i--) rem(i);
    rem(I);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:5:11: warning: unused variable 'b' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |           ^
Anna.cpp:5:13: warning: unused variable 'c' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |             ^
Anna.cpp:5:15: warning: unused variable 'd' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |               ^
Anna.cpp:5:17: warning: unused variable 'e' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                 ^
Anna.cpp:5:21: warning: unused variable 'j' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                     ^
Anna.cpp:5:23: warning: variable 'ii' set but not used [-Wunused-but-set-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                       ^~
Anna.cpp:5:26: warning: unused variable 'jj' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                          ^~
Anna.cpp:5:29: warning: unused variable 'zx' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                             ^~
Anna.cpp:5:32: warning: unused variable 'xc' [-Wunused-variable]
    5 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,I;
      |                                ^~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:10:11: warning: unused variable 'b' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |           ^
Bruno.cpp:10:13: warning: unused variable 'c' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |             ^
Bruno.cpp:10:15: warning: unused variable 'd' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |               ^
Bruno.cpp:10:17: warning: unused variable 'e' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |                 ^
Bruno.cpp:10:26: warning: unused variable 'jj' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |                          ^~
Bruno.cpp:10:29: warning: unused variable 'zx' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |                             ^~
Bruno.cpp:10:32: warning: unused variable 'xc' [-Wunused-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |                                ^~
Bruno.cpp:10:35: warning: variable 'L' set but not used [-Wunused-but-set-variable]
   10 |     int a,b,c,d,e,i,j,ii,jj,zx,xc,L,I;
      |                                   ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1296 KB Output is correct
2 Correct 0 ms 1288 KB Output is correct
3 Correct 1 ms 1288 KB Output is correct
4 Correct 2 ms 1300 KB Output is correct
5 Correct 1 ms 1292 KB Output is correct
6 Correct 2 ms 1300 KB Output is correct
7 Correct 0 ms 1288 KB Output is correct
8 Correct 0 ms 1300 KB Output is correct
9 Correct 1 ms 1296 KB Output is correct
10 Correct 0 ms 1288 KB Output is correct
11 Correct 0 ms 1296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 55 ms 8208 KB Partially correct
2 Partially correct 52 ms 8356 KB Partially correct
3 Partially correct 55 ms 8164 KB Partially correct
4 Partially correct 66 ms 8200 KB Partially correct
5 Partially correct 51 ms 8164 KB Partially correct
6 Partially correct 53 ms 8212 KB Partially correct
7 Partially correct 53 ms 8244 KB Partially correct
8 Partially correct 52 ms 8256 KB Partially correct
9 Partially correct 60 ms 8216 KB Partially correct
10 Partially correct 54 ms 8240 KB Partially correct
11 Partially correct 53 ms 8236 KB Partially correct
12 Partially correct 53 ms 8156 KB Partially correct
13 Partially correct 59 ms 8164 KB Partially correct
14 Partially correct 61 ms 8224 KB Partially correct
15 Partially correct 62 ms 8228 KB Partially correct
16 Partially correct 53 ms 8216 KB Partially correct
17 Partially correct 57 ms 8248 KB Partially correct
18 Partially correct 57 ms 8188 KB Partially correct
19 Partially correct 64 ms 8260 KB Partially correct
20 Partially correct 53 ms 8236 KB Partially correct
21 Partially correct 50 ms 8240 KB Partially correct
22 Partially correct 59 ms 8160 KB Partially correct
23 Partially correct 51 ms 8208 KB Partially correct
24 Partially correct 54 ms 8240 KB Partially correct
25 Partially correct 60 ms 8152 KB Partially correct
26 Partially correct 61 ms 8200 KB Partially correct
27 Partially correct 63 ms 8132 KB Partially correct
28 Partially correct 60 ms 8172 KB Partially correct
29 Partially correct 61 ms 8180 KB Partially correct
30 Partially correct 62 ms 8208 KB Partially correct
31 Partially correct 65 ms 8204 KB Partially correct
32 Partially correct 51 ms 8172 KB Partially correct
33 Partially correct 51 ms 8192 KB Partially correct