제출 #1175835

#제출 시각아이디문제언어결과실행 시간메모리
1175835thelegendary08Super Dango Maker (JOI22_dango3)C++17
22 / 100
256 ms720 KiB
#include "dango3.h" #include<bits/stdc++.h> #define pb push_back #define vi vector<int> #define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n'; #define f0r(i,n) for(int i = 0; i<n; i++) using namespace std; vi perm; int ask(vi quer){ vi q; // cout<<"QUER "<<' '; for(auto u : quer){ q.pb(perm[u]); // cout<<u<<' '; } // cout<<'\n'; int x = Query(q); return x; } void ans(vi a){ vi ret; for(auto u : a){ ret.pb(perm[u]); } Answer(ret); } void Solve(int N, int M) { f0r(i, N*M){ perm.pb(i + 1); } random_shuffle(perm.begin(), perm.end()); // for(auto u : perm)cout<<u<<' '; // cout<<'\n'; vi v; f0r(i, N*M){ v.pb(i); } while(v.size() != 0){ int lst = v.size(); vi fx; while(fx.size() < N){ // cout<<lst<<'\n'; int lo = 0; int hi = lst - 1; //first one such that can form stick, so this one is the first occurence of the dango while(lo < hi){ // cout<<lo<<' '<<hi<<'\n'; int mid = (lo + hi) / 2; vi quer; for(auto u : fx){ quer.pb(u); } f0r(i, mid + 1){ quer.pb(v[i]); } int x = ask(quer); // cout<<x<<'\n'; if(x >= 1){ hi = mid; } else{ lo = mid + 1; } } // cout<<lo<<" LO"<<'\n'; lst = lo; fx.pb(v[lst]); } // vout(fx); ans(fx); for(auto u : fx){ v.erase(find(v.begin(), v.end(), u)); } // vout(v); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...