Submission #930852

#TimeUsernameProblemLanguageResultExecution timeMemory
930852boris_mihovAncient Machine (JOI21_ancient_machine)C++17
70 / 100
47 ms8688 KiB
#include "Anna.h" #include <vector> void Anna(int N, std::vector <char> s) { bool foundX = false; for (int i = 0 ; i < N ; ++i) { if (!foundX && s[i] == 'X') { foundX = true; Send(1); } else if (foundX && s[i] == 'Z') { Send(1); } else { Send(0); } } }
#include "Bruno.h" #include <vector> void Bruno(int N, int L, std::vector <int> A) { int xPos = -1; std::vector <int> pos; for (int i = 0 ; i < N ; ++i) { if (A[i] == 1) { if (xPos == -1) xPos = i; pos.push_back(i); } } if (pos.empty()) { for (int i = 0 ; i < N ; ++i) { Remove(i); } return; } if (pos.back() < N - 1) pos.push_back(N - 1); for (int i = 0 ; i < xPos ; ++i) { Remove(i); } for (int i = 1 ; i < pos.size() ; ++i) { for (int j = pos[i] - 1 ; j > pos[i - 1] ; --j) { Remove(j); } Remove(pos[i]); } Remove(pos[0]); }

Compilation message (stderr)

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:33:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 1 ; i < pos.size() ; ++i)
      |                      ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...