Submission #440939

#TimeUsernameProblemLanguageResultExecution timeMemory
440939kig9981Ancient Machine (JOI21_ancient_machine)C++17
0 / 100
71 ms8012 KiB
#include "Anna.h" #include <bits/stdc++.h> #ifdef NON_SUBMIT #define TEST(n) (n) #define tout cerr #else #define TEST(n) ((void)0) #define tout cin #endif using namespace std; void Anna(int N, std::vector<char> S) { vector<int> R(N); int s=N, e=0; for(int i=0;i<N;i++) { if(S[i]=='X') s=min(s,i); else if(S[i]=='Y') e=i; } if(s>=e) { for(int i=0;i<N;i++) Send(0); return; } R[s]=R[e]=1; for(int i=s+1;i<e;i++) if(S[i]=='Y' && S[i+1]!='Y') { R[i]=1; R[i+1]=S[i+1]=='Z'; } for(auto r: R) Send(r); }
#include "Bruno.h" #include <bits/stdc++.h> #ifdef NON_SUBMIT #define TEST(n) (n) #define tout cerr #else #define TEST(n) ((void)0) #define tout cin #endif using namespace std; void Bruno(int N, int L, std::vector<int> A) { int s=N, e=0, j=0, p=-1; for(int i=0;i<N;i++) if(A[i]) { s=min(s,i); e=i; } if(s>=e) { for(int i=0;i<N;i++) Remove(i); return; } vector<char> S(N); vector<int> I; for(int i=0;i<N;i++) S[i]='?'; for(int i=s+1;i<e;i+=2) if(A[i]) { S[i++]='Y'; S[i]=A[i] ? 'Z':'X'; } S[s]='X'; S[e]='Z'; for(int i=0;i<N;i++) { if(S[i]=='?') Remove(i); else if(S[i]=='Y') p=i+1; } if(p==-1) { for(int i=0;i<N;i++) if(S[i]!='?') Remove(i); return; } if(p<e) { Remove(p); S[p]='?'; } for(int i=0;i<N;i++) if(S[i]!='?') { if(S[i]=='Z') { for(;;) { Remove(I.back()); I.pop_back(); if(I.size()==1) { Remove(i); break; } Remove(I.back()); I.pop_back(); } } else I.push_back(i); } while(I.size()) { Remove(I.back()); I.pop_back(); } }

Compilation message (stderr)

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:15:19: warning: unused variable 'j' [-Wunused-variable]
   15 |     int s=N, e=0, j=0, p=-1;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...