Submission #1137633

#TimeUsernameProblemLanguageResultExecution timeMemory
1137633KaleemRazaSyedCOVID tests (CEOI24_covid)C++20
10 / 100
1000 ms408 KiB
#include<bits/stdc++.h> using namespace std; int n; double p; bool ask(vector<bool> mask) { assert(mask.size() == (size_t)n); std::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> solve() { vector<bool> v(n, false), mask(n, false); for(int i = 0; i < n; i ++) { mask[i] = true; v[i] = ask(mask); mask[i] = false; } return v; } int main() { int T; scanf("%d %lf %d", &n, &p, &T); for (int i = 0; i < T; i++) { vector<bool> answer = solve(); 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; scanf(" %c", &verdict); if (verdict == 'W') exit(0); } return 0; }

Compilation message (stderr)

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