#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
void Solve(int N, int M) {
vector<vector<int>> a;
for(int i = 1; i <= N*M; i++) {
// vamos ver onde pôr o elemento i
int l = 0, r = sz(a) - 1;
while(l <= r) {
int mid = (l+r)/2;
vector<bool> q(N*M, 1);
for(auto it : a[mid]) q[it-1] = 0;
q[i - 1] = 0;
vector<int> make_query;
for(int j = 1; j <= N*M; j++) if(q[j-1]) make_query.pb(j);
if(Query(make_query) == M-1) r = mid-1;
else l = mid+1;
}
if(r+1 >= sz(a)) a.pb({i});
else a[r+1].pb(i);
}
for(int i = 0; i < M; i++) Answer(a[i]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
476 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
476 KB |
Output is correct |
2 |
Correct |
15 ms |
596 KB |
Output is correct |
3 |
Correct |
18 ms |
444 KB |
Output is correct |
4 |
Correct |
19 ms |
876 KB |
Output is correct |
5 |
Correct |
11 ms |
504 KB |
Output is correct |
6 |
Correct |
14 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
684 ms |
756 KB |
Output is correct |
2 |
Correct |
675 ms |
604 KB |
Output is correct |
3 |
Correct |
813 ms |
628 KB |
Output is correct |
4 |
Correct |
834 ms |
620 KB |
Output is correct |
5 |
Correct |
598 ms |
608 KB |
Output is correct |
6 |
Correct |
559 ms |
608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2574 ms |
764 KB |
Output is correct |
2 |
Correct |
2751 ms |
740 KB |
Output is correct |
3 |
Correct |
3121 ms |
676 KB |
Output is correct |
4 |
Correct |
2985 ms |
672 KB |
Output is correct |
5 |
Correct |
2396 ms |
732 KB |
Output is correct |
6 |
Correct |
2474 ms |
704 KB |
Output is correct |