# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
861145 | 2023-10-15T13:18:44 Z | JoanaPA | Carnival (CEOI14_carnival) | C++14 | 73 ms | 344 KB |
#include<iostream> #include<vector> #include<map> #include<unordered_set> #include<set> #include<algorithm> using namespace std; vector<int> resolver(int N) { // Hacemos consultas para ver que parejas coinciden 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; } } // Sabiendo las parejas, construimos la lista de disfraces vector<int> disfraces(N, 0); int disfracesDescubiertos = 0; for (int j = 0; j < N; j++) { // Vemos si coincide con otro nodo con disfraz asignado => le asignamos el mismo for (int i = 0; i < j; i++) { if (mismoDisfraz[i][j]) { disfraces[j] = disfraces[i]; } } if (disfraces[j] == 0) { // No coincide => nuevo disfraz disfracesDescubiertos++; disfraces[j] = disfracesDescubiertos; } } return disfraces; } int main() { int N, C; cin >> N; vector<int> solucion = resolver(N); cout << 0; for (int i = 0; i < N; ++i) { cout << " " << solucion[i]; } cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 39 ms | 344 KB | Partially correct |
2 | Partially correct | 49 ms | 344 KB | Partially correct |
3 | Partially correct | 42 ms | 344 KB | Partially correct |
4 | Partially correct | 38 ms | 344 KB | Partially correct |
5 | Partially correct | 38 ms | 344 KB | Partially correct |
6 | Partially correct | 54 ms | 344 KB | Partially correct |
7 | Partially correct | 49 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 48 ms | 344 KB | Partially correct |
2 | Partially correct | 45 ms | 344 KB | Partially correct |
3 | Partially correct | 25 ms | 344 KB | Partially correct |
4 | Partially correct | 45 ms | 344 KB | Partially correct |
5 | Partially correct | 46 ms | 344 KB | Partially correct |
6 | Partially correct | 45 ms | 344 KB | Partially correct |
7 | Partially correct | 58 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 49 ms | 344 KB | Partially correct |
2 | Partially correct | 49 ms | 344 KB | Partially correct |
3 | Partially correct | 54 ms | 344 KB | Partially correct |
4 | Partially correct | 52 ms | 344 KB | Partially correct |
5 | Partially correct | 51 ms | 344 KB | Partially correct |
6 | Partially correct | 53 ms | 344 KB | Partially correct |
7 | Partially correct | 53 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 44 ms | 344 KB | Partially correct |
2 | Partially correct | 53 ms | 344 KB | Partially correct |
3 | Partially correct | 59 ms | 344 KB | Partially correct |
4 | Partially correct | 54 ms | 344 KB | Partially correct |
5 | Partially correct | 50 ms | 344 KB | Partially correct |
6 | Partially correct | 56 ms | 344 KB | Partially correct |
7 | Partially correct | 42 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 73 ms | 344 KB | Partially correct |
2 | Partially correct | 47 ms | 344 KB | Partially correct |
3 | Partially correct | 50 ms | 344 KB | Partially correct |
4 | Partially correct | 46 ms | 344 KB | Partially correct |
5 | Partially correct | 45 ms | 340 KB | Partially correct |
6 | Partially correct | 51 ms | 344 KB | Partially correct |
7 | Partially correct | 55 ms | 344 KB | Partially correct |