Submission #818422

#TimeUsernameProblemLanguageResultExecution timeMemory
818422tengiz05Ancient Machine 2 (JOI23_ancient2)C++17
10 / 100
196 ms620 KiB
#include "ancient2.h"
#ifndef EVAL
#include "grader.cpp"
#endif

#include <string>
#include <vector>

using namespace std;
namespace {

}  // namespace

std::string Solve(int n) {
  int m = n + 2;
  std::vector<int> a(m), b(m);
  for (int i = 0; i < n - 1; i++) {
      a[i] = b[i] = i + 1;
  }
  string s(n, '?');
  for (int i = n - 1; i >= 0; i--) {
      a[i] = n;
      b[i] = n + 1;
      a[n] = b[n] = n;
      a[n + 1] = b[n + 1] = n + 1;
      int val = Query(m, a, b);
      if (val == n) {
          s[i] = '0';
      } else {
          s[i] = '1';
      }
  }
  return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...