# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598474 | mosiashvililuka | Ancient Machine (JOI21_ancient_machine) | C++17 | 66 ms | 8356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |