Submission #544845

#TimeUsernameProblemLanguageResultExecution timeMemory
544845MarcoMeijerSuper Dango Maker (JOI22_dango3)C++17
100 / 100
5171 ms12228 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; namespace { int query(set<int>& st) { vector<int> a; for (int x : st) a.push_back(x); return Query(a); } } // namespace void Solve(int N, int M) { vector<vector<int>> byGroup; vector<set<int>> notInGroups; byGroup.resize(M); notInGroups.resize(M); for (int i=0; i<M; i++) for (int j=1; j<=N*M; j++) notInGroups[i].insert(j); for (int i=1; i<=N*M; i++) { int lb=0, ub=M-1; while (lb != ub) { int mid=(lb+ub+1)/2; notInGroups[mid].erase(i); int res = query(notInGroups[mid]); notInGroups[mid].insert(i); if (res >= M - mid) ub = mid-1; else lb = mid; } byGroup[lb].push_back(i); for (int j=lb+1; j<M; j++) notInGroups[j].erase(i); } for (int i=0; i<M; i++) { Answer(byGroup[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...