This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |