#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, count = 2, prefs[155], vals[155];
cin >> n;
prefs[0] = 1;
string s = "1";
for (int i = 1; i < n; i++) {
s += " " + to_string(i+1);
cout << i+1 << " " << s << endl;
cin >> prefs[i];
}
vals[0] = 1;
for (int i = 1; i < n; i++) {
if (prefs[i] == prefs[i-1]+1) {
vals[i] = count;
count++;
}
}
srand(28);
vector<int> nums;
for (int i = 0; i < n; i++) {
if (vals[i] == 0) {
vector<int> temp;
for (int a : nums){
temp.push_back(a);
}
while (temp.size() > 1) {
int ind = rand() % temp.size(), v = temp[ind], in;
cout << 2 << " " << v << " " << (i+1) << endl;
cin >> in;
if (in == 1) {
vals[i] = vals[v];
break;
}
temp.erase(temp.begin() + ind);
}
if (vals[i] == 0) {
vals[i] = vals[temp[0]];
}
} else {
nums.push_back(i+1);
}
}
cout << 0;
for (int i = 0; i < n; i++) {
cout << " " << vals[i];
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Integer -32767 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Integer 69 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Integer 32765 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Integer 0 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer 4 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |