Submission #936831

# Submission time Handle Problem Language Result Execution time Memory
936831 2024-03-02T19:10:13 Z TAhmed33 Super Dango Maker (JOI22_dango3) C++17
0 / 100
164 ms 880 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
int n, m;
int get (vector <int> &x) {
  set <int> dd; for (auto i : x) dd.insert(i);
  vector <int> l;
  for (int i = 1; i <= n * m; i++) {
    if (!dd.count(i)) l.push_back(i);
  }
  return m - Query(l);
}
void Solve (int N, int M) {
  n = N; m = M;
  vector <int> cur[m + 1];
  for (int i = 1; i <= n * m; i++) {
    int l = 1, r = m, ans = -1;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (get(cur[mid]) == 2) {
        l = mid + 1;
      } else {
        r = mid - 1; ans = mid;
      }
    }
    assert(ans != -1);
    cur[ans].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    Answer(cur[i]);
  }
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 61 ms 816 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 164 ms 880 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -