Submission #737705

# Submission time Handle Problem Language Result Execution time Memory
737705 2023-05-07T15:00:23 Z iee Prisoner Challenge (IOI22_prison) C++17
100 / 100
14 ms 980 KB
#include <bits/stdc++.h>
using namespace std;
void dfs(int l, int r, int L, int R, bool d, int id, int im, auto &a) {
  if (l > r) return;
  l++, r--;
  a[id][0] = d;
  for (int i = L; i <= R; ++i)
    if (i < l) a[id][i] = (d ? -2 : -1);
    else if (i > r) a[id][i] = (d ? -1 : -2);
  int s = r - l + 1, num = min(s, 2 + (s > 4)), len = ceil(1.0 * s / num);
  for (int x = l, y, i = 1; i <= num; x = y + 1, ++i) {
    y = min(r, x + len - 1);
    for (int j = x; j <= y; ++j)
      a[id][j] = im + i;
    dfs(x, y, l - 1, r + 1, !d, im + i, im + num, a);
  }
}
vector<vector<int>> devise_strategy(int n) {
  vector<vector<int>> a(21, vector<int>(n + 1));
  dfs(1, n, 1, n, 0, 0, 0, a);
  return a;
}

Compilation message

prison.cpp:3:62: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
    3 | void dfs(int l, int r, int L, int R, bool d, int id, int im, auto &a) {
      |                                                              ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 276 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 5 ms 556 KB Output is correct
5 Correct 8 ms 852 KB Output is correct
6 Correct 14 ms 980 KB Output is correct
7 Correct 13 ms 968 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 2 ms 300 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 11 ms 816 KB Output is correct