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;
vector <int> rgraf[10005];
vector <int> graf[10005];
int mt[10005];
bool used[10005];
int ime[10005];
bool bp(int v) {
if (used[v]) return false;
used[v] = true;
for (auto c : graf[v]) {
if(!mt[c] || bp(mt[c])) {
mt[c] = v;
ime[v] = c;
return true;
}
}
return false;
}
bool bio[10005];
bool good(int v) {
if(used[v]) return true;
used[v] = true;
for (auto c : rgraf[v]) {
if (!ime[c] || !good(ime[c])) return false;
}
return true;
}
int main()
{
int n, m;
cin >> n >> m;
for(int i=1; i<=m; i++){
int a, b;
cin >> a >> b;
graf[a].push_back(b);
rgraf[b].push_back(a);
}
int mxm = 0;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++) used[j] = 0;
mxm += bp(i);
}
for(int i=1; i<=n; i++){
if(!ime[i]){
cout << "Mirko\n";
continue;
}
for(int j=1; j<=n; j++){
used[j] = 0;
}
if(good(ime[i])) cout << "Slavko\n";
else cout << "Mirko\n";
}
return 0;
}
# | 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... |