Submission #936832

#TimeUsernameProblemLanguageResultExecution timeMemory
936832TAhmed33Super Dango Maker (JOI22_dango3)C++17
100 / 100
5976 ms1308 KiB
#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; cur[mid].push_back(i); if (get(cur[mid]) == 2) { l = mid + 1; } else { r = mid - 1; ans = mid; } cur[mid].pop_back(); } assert(ans != -1); cur[ans].push_back(i); } for (int i = 1; i <= m; i++) { Answer(cur[i]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...