# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838162 | jamielim | Planinarenje (COCI18_planinarenje) | C++14 | 2 ms | 852 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |