Submission #1109872

#TimeUsernameProblemLanguageResultExecution timeMemory
1109872ozner77Parachute rings (IOI12_rings)C++17
0 / 100
160 ms262144 KiB
#include <bits/stdc++.h> using namespace std; map<int, int> sumas; vector<vector<int>> V; vector<vector<int>> R; int con1 = 0; int N; void Init(int N){ vector<int> V1(N, 0); vector<int> J; for(int i = 0; i < N; i++){ V.push_back(V1); R.push_back(J); } } void Link(int A, int B){ R[A].push_back(B); R[B].push_back(A); V[A][B] = 1; V[B][A] = 1; sumas[A]++; sumas[B]++; } void cadena(int i, int j, vector<int> visitados){ visitados[j] = 1; if(V[i][j] == 1){ if(sumas[j] == 2){ con1++; } } else { if(sumas[j] == 1){ con1++; } } for(int k = 0; k < R[j].size(); k++){ if(visitados[R[j][k]] == 0 && R[j][k] != i){ cadena(i, R[j][k], visitados); } } } int CountCritical(){ int res = 0; for(int i = 0; i < N; i++){ bool com = true; for(int j = 0; j < N; j++){ if(i != j){ if(V[i][j] == 1){ if(sumas[j] == 1){ continue; } else if(sumas[j] > 3){ com = false; break; } } else { if(sumas[j] == 0){ continue; } else if(sumas[j] > 2){ com = false; break; } else { vector<int> visitados(N, 0); con1 = 0; cadena(i, j, visitados); if(con1 != 2){ com = false; break; } } } } } if(com){ res++; } } return res; }

Compilation message (stderr)

rings.cpp: In function 'void cadena(int, int, std::vector<int>)':
rings.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(int k = 0; k < R[j].size(); k++){
      |                    ~~^~~~~~~~~~~~~
#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...