Submission #62421

#TimeUsernameProblemLanguageResultExecution timeMemory
62421zetapiParachute rings (IOI12_rings)C++14
0 / 100
8 ms6140 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=1e5; vector<int> cur,vec[MAX]; int N,mark[MAX]; void Init(int N_) { N=N_; for(int A=1;A<=N;A++) { mark[A]=0; vec[A].clear(); } return ; } void Link(int A, int B) { vec[A].pb(B); vec[B].pb(A); return ; } void dfs(int node,int br) { cur.pb(node); mark[node]=1; for(auto A:vec[node]) { if(mark[A] or A==br) continue; dfs(A,br); } return ; } int ok() { int co=0,so=0,lo=0,e=0; for(auto A:cur) { e+=vec[A].size(); if(vec[A].size()==1) co++; else if(vec[A].size()==2) so++; else lo++; } if(e/2>=cur.size()) return 0; return (co<=2 and lo==0); } int CountCritical() { int res=0; for(int A=1;A<=N;A++) { for(int B=1;B<=N;B++) mark[B]=0; for(int B=1;B<=N;B++) { if(!mark[B]) { cur.clear(); dfs(B,A); res+=ok(); } } } return res; } /*signed main() { ios_base::sync_with_stdio(false); return 0; }*/

Compilation message (stderr)

rings.cpp: In function 'int ok()':
rings.cpp:61:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(e/2>=cur.size())
     ~~~^~~~~~~~~~~~
#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...