Submission #417099

#TimeUsernameProblemLanguageResultExecution timeMemory
417099tqbfjotldAncient Machine (JOI21_ancient_machine)C++17
0 / 100
38 ms3172 KiB
#include "Anna.h" #include <vector> using namespace std; ///17 bits for 1st X, 17 bits for last Z, N bits for isY void Anna(int N, std::vector<char> S) { int Xpos = -1; int Zpos = -1; for (int x = 0; x<N; x++){ if (S[x]=='Z') Zpos = x; if (Xpos==-1 && S[x]=='X') Xpos = x; } for (int x = 16; x>=0; x--){ Send((bool)(Xpos&(1<<x))); } for (int x = 16; x>=0; x--){ Send((bool)(Zpos&(1<<x))); } for (int x = 0; x<N; x++){ Send(S[x]=='Y'); } }
#include "Bruno.h" #include <vector> #include <cassert> using namespace std; void Bruno(int N, int L, std::vector<int> A) { assert(L==N+34); int Xpos = 0; int Zpos = 0; for (int x = 0; x<17; x++){ Xpos = (Xpos<<1)+A[x]; } for (int x = 17; x<34; x++){ Zpos = (Zpos<<1)+A[x]; } if (Xpos==(1<<17)-1 || Zpos==(1<<17)-1 || Xpos>Zpos){ for (int x = 0; x<N; x++){ Remove(x); } return; } for (int x = Xpos+1; x<Zpos; x++){ if (!A[x-34]){ Remove(x); } } for (int x = Xpos+1; x<Zpos; x++){ if (A[x-34]){ Remove(x); } } for (int x = 0; x<=Xpos; x++){ Remove(x); } for (int x = Zpos; x<N; x++){ Remove(x); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...