Submission #1044230

#TimeUsernameProblemLanguageResultExecution timeMemory
1044230CyberCowCOVID tests (CEOI24_covid)C++17
0 / 100
68 ms588 KiB
#include <cassert> #include <cstdio> #include <string> #include <vector> #include <iostream> using namespace std; int N; double P; bool test_students(int l, int r) { cout << "Q "; for (int i = 0; i < l; i++) { cout << 0; } for (int i = l; i <= r; i++) { cout << 1; } for (int i = r + 1; i < N; i++) { cout << 0; } cout << endl; char c; cin >> c; if (c == 'P') return 1; return 0; } void find_positive(vector<bool> v) { cout << "A "; for (int i = 0; i < v.size(); i++) { cout << v[i]; } cout << endl; char c; cin >> c; } vector<bool> answer; void recus(int l, int r) { if (l == r) { if(test_students(l, r)) { answer[l] = 1; } } else { int m = (l + r) / 2; int hm = test_students(l, m); if (hm == 0) { if (m + 1 != r) recus(m + 1, r); else { answer[m + 1] = 1; } } else { if (l != m) recus(l, m); else { answer[l] = 1; } hm = test_students(m + 1, r); if (hm == 1) { if (m + 1 != r) { recus(m + 1, r); } else { answer[m + 1] = 1; } } } } } int main() { int T; cin >> N >> P >> T; vector<bool>zro; for (int i = 0; i < N; i++) { zro.push_back(0); } for (int i = 0; i < T; i++) { answer = zro; recus(0, N - 1); find_positive(answer); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'void find_positive(std::vector<bool>)':
Main.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < v.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...