# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299011 | TadijaSebez | Planinarenje (COCI18_planinarenje) | C++11 | 15 ms | 640 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 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)
# | 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... |