제출 #1044318

#제출 시각아이디문제언어결과실행 시간메모리
1044318CyberCowCOVID tests (CEOI24_covid)C++17
52.36 / 100
6393 ms344 KiB
#include <cassert> #include <cstdio> #include <string> #include <vector> #include <iostream> using namespace std; int N; double P; inline 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; } vector<bool> answer; inline void recus(int l, int r, int st) { 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 || st == 0) recus(m + 1, r, st); else { answer[m + 1] = 1; } } else { if (l != m) recus(l, m, 1); else { answer[l] = 1; } m++; hm = test_students(m, r); m--; if (hm == 1) { if (m + 1 != r) { recus(m + 1, r, st); } else { answer[m + 1] = 1; } } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); 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, 0); cout << "A "; for (int i = 0; i < answer.size(); i++) { cout << answer[i]; } cout << endl; char c; cin >> c; } return 0; }

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

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