Submission #638120

# Submission time Handle Problem Language Result Execution time Memory
638120 2022-09-04T16:28:34 Z fadi57 Super Dango Maker (JOI22_dango3) C++17
100 / 100
4386 ms 1220 KB
#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

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:27:6: warning: unused variable 'cnt' [-Wunused-variable]
   27 |  int cnt=0;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 744 KB Output is correct
2 Correct 60 ms 724 KB Output is correct
3 Correct 76 ms 760 KB Output is correct
4 Correct 62 ms 752 KB Output is correct
5 Correct 49 ms 740 KB Output is correct
6 Correct 57 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1095 ms 984 KB Output is correct
2 Correct 1051 ms 1096 KB Output is correct
3 Correct 1217 ms 984 KB Output is correct
4 Correct 1191 ms 960 KB Output is correct
5 Correct 898 ms 976 KB Output is correct
6 Correct 910 ms 988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3916 ms 1220 KB Output is correct
2 Correct 3804 ms 1204 KB Output is correct
3 Correct 4278 ms 1100 KB Output is correct
4 Correct 4386 ms 1068 KB Output is correct
5 Correct 3267 ms 1112 KB Output is correct
6 Correct 3315 ms 1104 KB Output is correct