#include <bits/stdc++.h>
using namespace std;
vector <int> graf[10005];
vector <int> rgraf[10005];
int mt[10005];
bool used[10005];
int ime[10005];
int pime[10005];
int pmt[100005];
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];
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++){
bio[mt[i]] = 1;
pime[i] = ime[i];
pmt[i] = mt[i];
}
for(int i=1; i<=n; i++){
if(!bio[i]){
cout << "Mirko\n";
continue;
}
int tren = mxm-1;
int koji = pime[i];
for(int j=1; j<=n; j++){
mt[j] = pmt[j];
ime[j] = pime[j];
}
mt[koji] = 0;
for(auto j : rgraf[koji]){
if(j == i) continue;
//cout << "pokusam " << j << endl;
if(ime[j]) continue;
for(int k=1; k<=n; k++) used[k] = 0;
used[i] = 1;
tren += bp(j);
}
//cout << mxm << " " << tren << endl;
if(tren-mxm) cout << "Slavko\n";
else cout << "Mirko\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
768 KB |
Output is correct |
2 |
Correct |
1 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
896 KB |
Output is correct |
2 |
Correct |
1 ms |
896 KB |
Output is correct |
3 |
Correct |
2 ms |
896 KB |
Output is correct |
4 |
Correct |
2 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
1152 KB |
Output is correct |
2 |
Correct |
49 ms |
1216 KB |
Output is correct |
3 |
Correct |
45 ms |
1144 KB |
Output is correct |
4 |
Correct |
51 ms |
1152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
896 KB |
Output is correct |
2 |
Correct |
6 ms |
896 KB |
Output is correct |
3 |
Incorrect |
4 ms |
896 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
1000 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
1024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |