Submission #1206519

#TimeUsernameProblemLanguageResultExecution timeMemory
1206519avighnaCOVID tests (CEOI24_covid)C++20
23.51 / 100
1177 ms432 KiB
#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, t;
  double p;
  std::cin >> n >> p >> t;

  if (t == 1) {
    std::vector<bool> ans(n);
    for (int i = 0; i < n; ++i) {
      std::cout << "Q ";
      for (int j = 0; j < n; ++j) {
        std::cout << (i == j);
      }
      std::cout << std::endl;
      char c;
      std::cin >> c;
      ans[i] = c == 'P';
    }
    std::cout << "A ";
    for (int i = 0; i < n; ++i) {
      std::cout << ans[i];
    }
    std::cout << std::endl;
    char c;
    std::cin >> c;
    return 0;
  }

  while (t--) {
    std::string ans(n, '0');
    for (int i = 0; i < n; ++i) {

      auto idx =
          *std::ranges::partition_point(std::views::iota(i, n), [&](int j) {
            std::string q(n, '0');
            for (int idx = i; idx <= j; ++idx) {
              q[idx] = '1';
            }
            std::cout << "Q " << q << std::endl;
            char c;
            std::cin >> c;
            return c == 'N';
          });
      if (idx < n) {
        ans[idx] = '1';
      }
      i = idx;
    }
    std::cout << "A " << ans << std::endl;
    char c;
    std::cin >> c;
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...