Submission #638120

#TimeUsernameProblemLanguageResultExecution timeMemory
638120fadi57Super Dango Maker (JOI22_dango3)C++17
100 / 100
4386 ms1220 KiB
#include <bits/stdc++.h> #include "dango3.h" //#include "grader.cpp" using namespace std; vector<int>ans[30]; int done[100000+9]; int n,m; bool check(int idx,int x){ memset(done,0,sizeof(done)); vector<int>v; done[x]=1; for(auto it:ans[idx]){ done[it]=1; } for(int i=1;i<=n*m;i++){ if(done[i]){ continue; } v.push_back(i); } return (Query(v)==m-2); } void Solve(int N, int M) { int cnt=0; n=N; m=M; int maxi=0; for(int i=1;i<=N*M;i++){ int st=1; int en=maxi; int last=0; while(st<=en){ int mid=(st+en)/2; if(check(mid,i)){ last=mid; st=mid+1; }else{ en=mid-1; } } ans[last+1].push_back(i); maxi=max(maxi,last+1); } for(int i=1;i<=m;i++){ Answer(ans[i]); } }

Compilation message (stderr)

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:27:6: warning: unused variable 'cnt' [-Wunused-variable]
   27 |  int cnt=0;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...