Submission #860949

#TimeUsernameProblemLanguageResultExecution timeMemory
860949BlancaHMCarnival (CEOI14_carnival)C++14
20 / 100
67 ms596 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...