제출 #440652

#제출 시각아이디문제언어결과실행 시간메모리
440652ParisaPlaninarenje (COCI18_planinarenje)C++17
160 / 160
16 ms4492 KiB
#include<bits/stdc++.h> #include<string> using namespace std; #define S second #define F first #define pb push_back #define MP make_pair #define ll long long #define PAIR pair <ll ,ll > #define reversee(x) reverse(x.begin(), x.end()); #define sortt(x) sort(x.begin(), x.end()); #define flash ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define cout(l) cout<<fixed<<setprecision(10)<<l; const ll maxn=1e5+10, mod=1e9+7 , inf=2e9 , lg=20; ll mark[maxn] , match[maxn] , fmatch[maxn]; vector<ll> adj[maxn]; bool dfs(ll v){ mark[v]=1; for(auto u:adj[v]){ if(match[u]==-1 || (!mark[match[u]] && dfs(match[u]))) { match[u]=v; fmatch[v]=1; return 1; } } return 0; } int main(){ ll n , m; cin>>n>>m; for(int i=0;i<m;i++){ ll x, y; cin>>x>>y; x-- , y--; adj[x].pb(y); } memset(match , -1 , sizeof(match)); bool flag=1; while(flag){ flag=0; memset(mark , 0 , sizeof(mark)); for(int i=0;i<n;i++){ if(!fmatch[i] && !mark[i] && dfs(i)){ flag=1; } } } for(int i=0;i<n;i++){ if(!fmatch[i] ){ dfs(i); } } for(int i=0;i<n;i++){ if(mark[i]) cout<<"Mirko"<<endl; else cout<<"Slavko"<<endl; } }
#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...