#include <bits/stdc++.h>
using namespace std;
#include "dango3.h"
//im suffering from pain
int vis[20005], n, m;
int qry(vector <int> &v){
for(int i=1;i<=m*n;i++)vis[i] = 1;
for(auto i : v)vis[i] = 0;
vector <int> bru;
for(int i=1;i<=n*m;i++)if(vis[i])bru.push_back(i);
return Query(bru);
}
int ok[200005];
bool cmp(vector <int> &a, vector <int> &b){
return (int)a.size() < (int)b.size();
}
void Solve(int N, int M) {
//pain.
n = N, m = M;
vector <int> x;
for(int i=1;i<=n*m;i++){
x.push_back(i);
ok[i] = Query(x);
}
vector < vector <int> > ans;
for(int i=n*m;i>=1;i--){
if(ok[i] != ok[i-1]){
vector <int> hi = {i};
ans.push_back(hi);
}
else{
sort(ans.begin(), ans.end(), cmp);
for(auto &j : ans){
vector <int> tmp = j;
tmp.push_back(i);
if(qry(tmp) == M - 1){
j.push_back(i);
break;
}
}
}
}
for(auto i : ans)Answer(i);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
388 KB |
Output is correct |
2 |
Correct |
22 ms |
468 KB |
Output is correct |
3 |
Correct |
11 ms |
340 KB |
Output is correct |
4 |
Correct |
12 ms |
388 KB |
Output is correct |
5 |
Correct |
14 ms |
408 KB |
Output is correct |
6 |
Correct |
17 ms |
412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
672 ms |
684 KB |
Output is correct |
2 |
Correct |
652 ms |
576 KB |
Output is correct |
3 |
Correct |
285 ms |
568 KB |
Output is correct |
4 |
Correct |
276 ms |
584 KB |
Output is correct |
5 |
Correct |
371 ms |
572 KB |
Output is correct |
6 |
Correct |
414 ms |
580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2663 ms |
736 KB |
Output is correct |
2 |
Correct |
2656 ms |
776 KB |
Output is correct |
3 |
Correct |
1100 ms |
888 KB |
Output is correct |
4 |
Correct |
1094 ms |
784 KB |
Output is correct |
5 |
Correct |
1698 ms |
760 KB |
Output is correct |
6 |
Correct |
1373 ms |
740 KB |
Output is correct |