제출 #1216305

#제출 시각아이디문제언어결과실행 시간메모리
1216305PenguinsAreCuteSuper Dango Maker (JOI22_dango3)C++17
22 / 100
594 ms616 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; void Solve(int N, int M) { vector<bool> used(N*M,0); for(int i=0;i<M;i++) { vector<int> cur(N, -1); auto check = [&used,&cur](int m) -> bool { vector<int> qry; int ptr = 0; while(qry.size() < m) { if(!used[ptr]) qry.push_back(ptr+1); ptr++; } for(auto k: cur) if(~k) qry.push_back(k); return Query(qry); }; int prevL = (M - i) * N; int g = M - i; int k = 0; while(2*g+(k<<(k+1)) > g+((k+1)<<(k+1))) k++; k = (1 << k); for(int j=0;j<N;j++) { int l = 0, h = prevL; while(h > k && check(h - k)) h -= k; l=max(0,h-k); while(h - l > 1) { int m = (l + h) / 2; if(check(m)) h = m; else l = m; } int ptr = -1, cnt = 0; while(cnt <= l) { if(!used[++ptr]) cnt++; } used[ptr] = 1; cur[j] = ptr+1; prevL = l; } Answer(cur); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...