# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253330 | mamadmokhi | Planinarenje (COCI18_planinarenje) | C++17 | 11 ms | 896 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.
// In the name of Allah
// There is no power but from God the Almighty
// No God except Allah
#include <bits/stdc++.h>
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int ,int>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mox=5e3+9;
vector<int> v[2*mox];
bool visit[2*mox];
int mach[2*mox];
bool win[mox];
bool dfs(int x)
{
if(visit[x])
return 0;
visit[x]=1;
win[x]=1;
for(int i:v[x])
{
if(mach[i]==0||dfs(mach[i]))
{
mach[i]=x;
mach[x]=i;
return 1;
}
}
return 0;
}
int32_t main()
{
ios
int n,m;
cin>>n>>m;
for(int i=0 ; i<m ; i++)
{
int a,b;
cin>>a>>b;
v[a].pb(b+n);
}
for(int i=1 ; i<=n ; i++)
{
dfs(i);
memset(visit,0,sizeof(visit));
}
memset(win,0,sizeof(win));
for(int i=1 ; i<=n ; i++)
{
if(mach[i]==0)
{
dfs(i);
memset(visit,0,sizeof(visit));
}
}
for(int i=1 ; i<=n ; i++)
{
if(win[i])
{
cout<<"Mirko"<<'\n';
}
else
cout<<"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... |