제출 #417133

#제출 시각아이디문제언어결과실행 시간메모리
417133tqbfjotldAncient Machine (JOI21_ancient_machine)C++17
69 / 100
82 ms8040 KiB
#include "Anna.h" #include <vector> using namespace std; ///17 bits for 1st X, N bits for isZ 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 = 0; x<N; x++){ Send(S[x]=='Z'); } }
#include "Bruno.h" #include <vector> #include <cassert> using namespace std; void Bruno(int N, int L, std::vector<int> A) { assert(L==N+17); int Xpos = 0; int Zpos = 0; for (int x = 0; x<17; x++){ Xpos = (Xpos<<1)+A[x]; } if (Xpos==(1<<17)-1){ for (int x = 0; x<N; x++){ Remove(x); } return; } vector<int> rem; for (int x = 0; x<Xpos; x++){ Remove(x); } for (int x = Xpos+1; x<N; x++){ if (A[x+17]){ while (!rem.empty()){ Remove(rem.back()); rem.pop_back(); } Remove(x); } else{ rem.push_back(x); } } Remove(Xpos); for (auto x : rem){ Remove(x); } }

컴파일 시 표준 에러 (stderr) 메시지

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:8:9: warning: variable 'Zpos' set but not used [-Wunused-but-set-variable]
    8 |     int Zpos = -1;
      |         ^~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:10:9: warning: unused variable 'Zpos' [-Wunused-variable]
   10 |     int Zpos = 0;
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...