Submission #1060252

# Submission time Handle Problem Language Result Execution time Memory
1060252 2024-08-15T12:07:00 Z MilosMilutinovic Park (JOI17_park) C++14
67 / 100
235 ms 864 KB
#include "park.h"
#include <bits/stdc++.h>

using namespace std;

static int Place[1400];

void Detect(int T, int n) {
  vector<bool> done(n);
  done[0] = true;
  vector<vector<int>> g(n);
  function<void(int)> Solve = [&](int v) {
    if (done[v]) {
      return;
    }
    while (true) {
      for (int i = 0; i < n; i++) {
        Place[i] = done[i] ? 1 : 0;
      }
      Place[v] = 1;
      if (Ask(0, v, Place)) {
        break;
      }
      int low = 0, high = n - 1, p = -1;
      while (low <= high) {
        int mid = (low + high) >> 1;
        for (int i = 0; i < n; i++) {
          if (done[i] || i == v || i <= mid) {
            Place[i] = 1;
          } else {
            Place[i] = 0;
          }
        }
        if (Ask(0, v, Place)) {
          p = mid;
          high = mid - 1;
        } else {
          low = mid + 1;
        }
      }
      Solve(p);
    }
    vector<int> que(1, 0);
    for (int b = 0; b < (int) que.size(); b++) {
      int i = que[b];
      for (int j : g[i]) {
        que.push_back(j);
      }
    }
    int low = 0, high = (int) que.size() - 1, p = -1;
    while (low <= high) {
      int mid = (low + high) >> 1;
      for (int i = 0; i < n; i++) {
        Place[i] = 0;
      }
      for (int i = 0; i <= mid; i++) {
        Place[que[i]] = 1;
      }
      Place[v] = 1;
      if (Ask(0, v, Place)) {
        p = que[mid];
        high = mid - 1;
      } else {
        low = mid + 1;
      }
    }
    g[p].push_back(v);
    Answer(min(p, v), max(p, v));
    done[v] = true;
  };
  for (int i = 1; i < n; i++) {
    if (!done[i]) {
      Solve(i);
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 234 ms 596 KB Output is correct
2 Correct 82 ms 612 KB Output is correct
3 Correct 123 ms 596 KB Output is correct
4 Correct 228 ms 612 KB Output is correct
5 Correct 235 ms 864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 560 KB Output is correct
2 Correct 129 ms 348 KB Output is correct
3 Correct 107 ms 348 KB Output is correct
4 Correct 88 ms 600 KB Output is correct
5 Correct 108 ms 556 KB Output is correct
6 Correct 116 ms 552 KB Output is correct
7 Correct 94 ms 344 KB Output is correct
8 Correct 99 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 348 KB Output is correct
2 Correct 119 ms 348 KB Output is correct
3 Correct 122 ms 544 KB Output is correct
4 Correct 150 ms 348 KB Output is correct
5 Correct 132 ms 596 KB Output is correct
6 Correct 171 ms 604 KB Output is correct
7 Correct 166 ms 600 KB Output is correct
8 Correct 128 ms 348 KB Output is correct
9 Correct 132 ms 556 KB Output is correct
10 Correct 161 ms 596 KB Output is correct
11 Correct 148 ms 596 KB Output is correct
12 Correct 120 ms 348 KB Output is correct
13 Correct 176 ms 348 KB Output is correct
14 Correct 145 ms 588 KB Output is correct
15 Correct 172 ms 596 KB Output is correct
16 Correct 98 ms 348 KB Output is correct
17 Correct 230 ms 604 KB Output is correct
18 Correct 151 ms 576 KB Output is correct
19 Correct 192 ms 596 KB Output is correct
20 Correct 126 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 600 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -