Submission #299011

#TimeUsernameProblemLanguageResultExecution timeMemory
299011TadijaSebezPlaninarenje (COCI18_planinarenje)C++11
160 / 160
15 ms640 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back const int N=5050; vector<int> E[N]; int mch[N]; bool was[N]; void cl(){for(int i=0;i<N;i++)was[i]=0;} bool DFS(int u){ if(was[u])return 0; was[u]=1; for(int v:E[u]){ if(!mch[v]){ mch[v]=u; return 1; }else{ if(DFS(mch[v])){ mch[v]=u; return 1; } } } return 0; } bool ok[N]; void EXP(int u){ for(int v:E[u]){ assert(mch[v]); if(ok[mch[v]]){ ok[mch[v]]=0; EXP(mch[v]); } } } int main(){ int n,m; scanf("%i %i",&n,&m); for(int i=1;i<=m;i++){ int u,v; scanf("%i %i",&u,&v); E[u].pb(v); } for(int i=1;i<=n;i++)cl(),ok[i]=DFS(i); for(int i=1;i<=n;i++)if(!ok[i])EXP(i); for(int i=1;i<=n;i++){ if(ok[i])printf("Slavko\n"); else printf("Mirko\n"); } return 0; }

Compilation message (stderr)

planinarenje.cpp: In function 'int main()':
planinarenje.cpp:37:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   37 |  scanf("%i %i",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~
planinarenje.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   40 |   scanf("%i %i",&u,&v);
      |   ~~~~~^~~~~~~~~~~~~~~
#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...
#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...