#include <iostream>
#include <vector>
#include <map>
#include <unordered_set>
#include <set>
#include <algorithm>
using namespace std;
vector<int> resolver(int N) {
vector<vector<int>> mismoDisfraz = vector<vector<int>>(N, vector<int>(N, 0));
int respuesta;
for (int i = 0; i < N; i++) {
for (int j = i+1; j < N; j++) {
cout << "2 " << i+1 << ' ' << j+1 << '\n';
cin >> respuesta;
mismoDisfraz[i][j] = mismoDisfraz[j][i] = 2-respuesta;
}
}
vector<int> disfraces(N, 0);
int disfracesDescubiertos = 0;
for (int j = 0; j < N; j++) {
for (int i = 0; i < j; i++) {
if (mismoDisfraz[i][j]) {
disfraces[j] = disfraces[i];
}
}
if (disfraces[j] == 0) {
disfracesDescubiertos++;
disfraces[j] = disfracesDescubiertos;
}
}
return disfraces;
}
int main() {
int N;
cin >> N;
vector<int> disfraces = resolver(N);
cout << '0';
for (int & disfraz: disfraces) {
cout << ' ' << disfraz;
}
cout << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
35 ms |
344 KB |
Partially correct |
2 |
Partially correct |
46 ms |
344 KB |
Partially correct |
3 |
Partially correct |
45 ms |
344 KB |
Partially correct |
4 |
Partially correct |
43 ms |
344 KB |
Partially correct |
5 |
Partially correct |
39 ms |
344 KB |
Partially correct |
6 |
Partially correct |
42 ms |
344 KB |
Partially correct |
7 |
Partially correct |
42 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
47 ms |
344 KB |
Partially correct |
2 |
Partially correct |
55 ms |
344 KB |
Partially correct |
3 |
Partially correct |
30 ms |
344 KB |
Partially correct |
4 |
Partially correct |
62 ms |
344 KB |
Partially correct |
5 |
Partially correct |
42 ms |
344 KB |
Partially correct |
6 |
Partially correct |
47 ms |
344 KB |
Partially correct |
7 |
Partially correct |
51 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
36 ms |
596 KB |
Partially correct |
2 |
Partially correct |
39 ms |
344 KB |
Partially correct |
3 |
Partially correct |
42 ms |
344 KB |
Partially correct |
4 |
Partially correct |
50 ms |
344 KB |
Partially correct |
5 |
Partially correct |
53 ms |
344 KB |
Partially correct |
6 |
Partially correct |
59 ms |
344 KB |
Partially correct |
7 |
Partially correct |
45 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
49 ms |
344 KB |
Partially correct |
2 |
Partially correct |
43 ms |
340 KB |
Partially correct |
3 |
Partially correct |
54 ms |
340 KB |
Partially correct |
4 |
Partially correct |
49 ms |
344 KB |
Partially correct |
5 |
Partially correct |
44 ms |
344 KB |
Partially correct |
6 |
Partially correct |
52 ms |
344 KB |
Partially correct |
7 |
Partially correct |
49 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
42 ms |
340 KB |
Partially correct |
2 |
Partially correct |
48 ms |
340 KB |
Partially correct |
3 |
Partially correct |
54 ms |
344 KB |
Partially correct |
4 |
Partially correct |
67 ms |
344 KB |
Partially correct |
5 |
Partially correct |
46 ms |
344 KB |
Partially correct |
6 |
Partially correct |
42 ms |
344 KB |
Partially correct |
7 |
Partially correct |
43 ms |
344 KB |
Partially correct |