Submission #620202

#TimeUsernameProblemLanguageResultExecution timeMemory
620202czhang2718Super Dango Maker (JOI22_dango3)C++17
22 / 100
2700 ms688 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a; i<=b; i++) int qry(vector<int> v){ cout << "? "; for(int x:v) cout << x << " "; cout << endl; int ret; cin >> ret; return ret; } void ans(vector<int> v){ cout << "! "; for(int x:v) cout << x << " "; cout << endl; } vector<vector<int>> dango; int ki[100000]; int it; void solve(int l, int r, int li, int ri){ if(r<l) return; int m=(l+r)/2; int p=li-1; auto ck=[&](int p)->bool{ // cout << "try " << p << endl; vector<int> qu; for(int i=0; i<=p; i++){ // cout << "ki[" << i << "] " << ki[i] << "\n"; if(ki[i] && ki[i]<it) continue; qu.push_back(i); } for(int i=0; i<m; i++){ for(int x:dango[i]) qu.push_back(x); } for(int &x:qu) x++; return Query(qu)<m; }; for(int k=31-__builtin_clz(ri-li+1); k>=0; k--){ if(p+(1<<k)<ri && ck(p+(1<<k))) p+=(1<<k); } p++; ki[p]=it; // cout << "ki " << p << " = " << it << endl; solve(l, m-1, li, p-1); solve(m+1, r, p, ri); } void Solve(int n, int m) { dango.resize(m); for(it=1; it<=n; it++){ solve(1, m, 0, n*m-1); int j=0; for(int i=0; i<n*m; i++){ if(ki[i]==it){ dango[j++].push_back(i); } } } for(int i=0; i<m; i++){ for(int &x:dango[i]) x++; Answer(dango[i]); } } // int main(){ // Solve(3, 2); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...