Submission #698903

# Submission time Handle Problem Language Result Execution time Memory
698903 2023-02-14T16:34:18 Z taher Carnival (CEOI14_carnival) C++17
100 / 100
24 ms 312 KB
#include <bits/stdc++.h>

using namespace std;

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

  auto Ask = [&](int low, int high) {
    cout << high - low + 1 << " ";
    for (int i = low; i <= high; i++) {
      cout << i + 1 << " \n"[i == high];
    }
    cout.flush();
    int ret;
    cin >> ret;
    return ret;
  };

  int cnt = 1;
  int n;
  cin >> n;
  vector<int> color(n);
  for (int i = 0; i < n; i++) {
    int low = 0, high = i - 1;
    while (low <= high) {
      int mid = low + (high - low) / 2;
      if (Ask(mid, i - 1) + 1 == Ask(mid, i)) {
        high = mid - 1;
      } else {
        low = mid + 1;
      }
    }
    int pos = low - 1;
    if (pos < 0) {
      color[i] = cnt++;
    } else {
      color[i] = color[pos];
    }
  }
  cout << 0 << " ";
  for (int i = 0; i < n; i++) {
    cout << color[i] << " \n"[i == n - 1];
  }
  cout.flush();
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 14 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 20 ms 208 KB Output is correct
4 Correct 15 ms 208 KB Output is correct
5 Correct 16 ms 208 KB Output is correct
6 Correct 13 ms 208 KB Output is correct
7 Correct 14 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 208 KB Output is correct
2 Correct 13 ms 208 KB Output is correct
3 Correct 14 ms 208 KB Output is correct
4 Correct 20 ms 208 KB Output is correct
5 Correct 8 ms 312 KB Output is correct
6 Correct 14 ms 208 KB Output is correct
7 Correct 19 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 208 KB Output is correct
2 Correct 7 ms 312 KB Output is correct
3 Correct 15 ms 308 KB Output is correct
4 Correct 24 ms 208 KB Output is correct
5 Correct 15 ms 208 KB Output is correct
6 Correct 19 ms 208 KB Output is correct
7 Correct 16 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 16 ms 208 KB Output is correct
4 Correct 21 ms 208 KB Output is correct
5 Correct 19 ms 208 KB Output is correct
6 Correct 14 ms 208 KB Output is correct
7 Correct 16 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 208 KB Output is correct
2 Correct 17 ms 212 KB Output is correct
3 Correct 22 ms 208 KB Output is correct
4 Correct 18 ms 208 KB Output is correct
5 Correct 19 ms 208 KB Output is correct
6 Correct 17 ms 208 KB Output is correct
7 Correct 18 ms 208 KB Output is correct