#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <tuple>
using namespace std;
typedef long long ll;
int n, m, k;
int p;
int t[200];
int tot[200];
int query(int fr, int to, int ad) {
int hm = (to-fr+2);
cout << hm;
for (int i = fr; i <= to; i++) cout << " " << i+1;
cout << " " << ad+1;
cout << endl;
int r;
cin >> r;
return r;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
tot[0] = 1;
for (int i = 1; i < n; i++) {
int st = 0, ed = i-1;
while (st < ed) {
int md = (st+ed)/2;
int r = query(0, md, i);
if (r > tot[md]) {
st = md+1;
}
else {
ed = md;
}
}
tot[i] = tot[i-1];
if (st == i-1 && query(0,st,i) > tot[i-1]) {
t[i] = tot[i]++;
}
else {
t[i] = t[st];
}
}
cout << 0;
for (int i = 0; i < n; i++) {
cout << " " << t[i]+1;
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
248 KB |
Output is correct |
2 |
Correct |
15 ms |
248 KB |
Output is correct |
3 |
Correct |
16 ms |
248 KB |
Output is correct |
4 |
Correct |
16 ms |
248 KB |
Output is correct |
5 |
Correct |
10 ms |
248 KB |
Output is correct |
6 |
Correct |
12 ms |
248 KB |
Output is correct |
7 |
Correct |
15 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
248 KB |
Output is correct |
2 |
Correct |
15 ms |
376 KB |
Output is correct |
3 |
Correct |
13 ms |
376 KB |
Output is correct |
4 |
Correct |
16 ms |
300 KB |
Output is correct |
5 |
Correct |
13 ms |
248 KB |
Output is correct |
6 |
Correct |
10 ms |
248 KB |
Output is correct |
7 |
Correct |
15 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
248 KB |
Output is correct |
2 |
Correct |
13 ms |
248 KB |
Output is correct |
3 |
Correct |
12 ms |
380 KB |
Output is correct |
4 |
Correct |
19 ms |
376 KB |
Output is correct |
5 |
Correct |
18 ms |
248 KB |
Output is correct |
6 |
Correct |
17 ms |
248 KB |
Output is correct |
7 |
Correct |
15 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
248 KB |
Output is correct |
2 |
Correct |
14 ms |
376 KB |
Output is correct |
3 |
Correct |
18 ms |
376 KB |
Output is correct |
4 |
Correct |
24 ms |
376 KB |
Output is correct |
5 |
Correct |
17 ms |
300 KB |
Output is correct |
6 |
Correct |
16 ms |
248 KB |
Output is correct |
7 |
Correct |
16 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
248 KB |
Output is correct |
2 |
Correct |
13 ms |
248 KB |
Output is correct |
3 |
Correct |
19 ms |
248 KB |
Output is correct |
4 |
Correct |
18 ms |
248 KB |
Output is correct |
5 |
Correct |
17 ms |
248 KB |
Output is correct |
6 |
Correct |
18 ms |
248 KB |
Output is correct |
7 |
Correct |
18 ms |
248 KB |
Output is correct |