#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <set>
#include <map>
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++;
}
}
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] = v;
break;
}
temp.erase(temp.begin() + ind);
}
if (vals[i] == 0) {
vals[i] = temp[0];
}
} else {
nums.push_back(vals[i]);
}
}
cout << 0;
for (int i = 0; i < n; i++) {
cout << " " << vals[i];
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Integer -32768 violates the range [1, 137] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer 1403379201 violates the range [1, 145] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer 32764 violates the range [1, 133] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer -1713954127 violates the range [1, 143] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer 959721760 violates the range [1, 149] |
2 |
Halted |
0 ms |
0 KB |
- |