Submission #810964

# Submission time Handle Problem Language Result Execution time Memory
810964 2023-08-06T18:30:12 Z taher Ancient Machine 2 (JOI23_ancient2) C++17
0 / 100
0 ms 208 KB
#include "ancient2.h"

#include <bits/stdc++.h>

using namespace std;

string Solve(int N) {
  string s;

  const int M = 1002;
  vector<int> a(M + 1);
  vector<int> b(M + 1);
  a[0] = 1;
  a[1] = 1;
  b[1] = 1;

  b[0] = 2;
  b[2] = 2;
  a[2] = 2;

  for (int i = 0; i < N; i++) {
    int ret = Query(M, a, b);

    if (ret == i + 1) {
      s += '0';
      a[i] = i + 1;
    } else {
      s += '1';
      b[i] = i + 1;
    }

    a[i + 1] = i + 2;
    a[i + 2] = i + 2;
    b[i + 2] = i + 2;

    b[i + 1] = i + 3;
    b[i + 3] = i + 3;
    a[i + 3] = i + 3;
  }

  return s;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -