제출 #1227561

#제출 시각아이디문제언어결과실행 시간메모리
1227561SpyrosAlivCOVID tests (CEOI24_covid)C++20
10 / 100
1008 ms408 KiB
#include <bits/stdc++.h> using namespace std; int N; double P; bool test_students(vector<bool> mask) { assert(mask.size() == (size_t)N); string mask_str(N, ' '); for (int i = 0; i < N; i++) mask_str[i] = mask[i] ? '1' : '0'; printf("Q %s\n", mask_str.c_str()); fflush(stdout); char answer; scanf(" %c", &answer); return answer == 'P'; } vector<bool> find_positive() { int n = N; vector<bool> curr; for (int i = 0; i < n; i++) curr.push_back(false); vector<bool> ans; for (int i = 0; i < n; i++) { curr[i] = true; ans.push_back(test_students(curr)); curr[i] = false; } return ans; } void solve() { vector<bool> answer = find_positive(); assert(answer.size() == (size_t)N); string answer_str(N, ' '); for (int j = 0; j < N; j++) answer_str[j] = answer[j] ? '1' : '0'; printf("A %s\n", answer_str.c_str()); fflush(stdout); char verdict; cin >> verdict; assert(verdict != 'W'); } int main() { int T; scanf("%d %lf %d", &N, &P, &T); // You may perform any extra initialization here. while (T--) solve(); return 0; }

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

Main.cpp: In function 'bool test_students(std::vector<bool>)':
Main.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf(" %c", &answer);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:52:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     scanf("%d %lf %d", &N, &P, &T);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...