Submission #838162

#TimeUsernameProblemLanguageResultExecution timeMemory
838162jamielimPlaninarenje (COCI18_planinarenje)C++14
0 / 160
2 ms852 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb emplace_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() typedef long long ll; typedef pair<int,int> ii; typedef pair<ii,ii> i4; typedef vector<int> vi; const int MOD=1000000007; const int INF=1012345678; const ll LLINF=1012345678012345678LL; const double PI=3.1415926536; const double EPS=1e-14; int n,m; int match[10005]; int vis[10005]; bool poss[5005]; vector<int> adj[10005]; bool dfs(int x){ if(vis[x])return 0; vis[x]=1; for(int i:adj[x]){ if(!match[i]||dfs(match[i])){ match[i]=x; match[x]=i; return 1; } } return 0; } int main(){ scanf("%d%d",&n,&m); int a,b; for(int i=0;i<m;i++){ scanf("%d%d",&a,&b); b+=n; adj[a].pb(b); adj[b].pb(a); } for(int i=1;i<=2*n;i++){ if(!vis[i])dfs(i); } for(int i=1;i<=n;i++)if(match[i])poss[i]=1; for(int i=1;i<=n;i++){ if(!poss[i]){ memset(vis,0,sizeof(vis)); if(!dfs(i))printf("Mirko\n"); else printf("Slavko\n"); }else printf("Slavko\n"); } }

Compilation message (stderr)

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