#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
const int N = 10010;
const int PW = (1 << 20);
vector<int> g[N];
int n, m, mt[N];
bool used[N];
bool try_kuhn(int v){
if (used[v]) return 0;
used[v] = 1;
for (int u : g[v])
if (mt[u] == -1 || try_kuhn(u)){
mt[u] = v;
return 1;
}
return 0;
}
bool good(int v){
if (used[v]) return 0;
used[v] = 1;
for (int u : g[v])
if (mt[u] == -1 || good(mt[u]))
return 1;
return 0;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m;
for (int i = 0; i < m; i++){
int x, y; cin >> x >> y;
x--; y--; y += n;
g[x].PB(y);
g[y].PB(x);
}
fill(mt, mt + n + n, -1);
for (int v = 0; v < n; v++){
fill(used, used + n + n, 0);
try_kuhn(v);
}
for (int v = n; v < n + n; v++)
if (mt[v] >= 0)
mt[mt[v]] = v;
for (int v = 0; v < n; v++)
if (mt[v] < 0)
cout << "Mirko\n";
else {
fill(used, used + n + n, 0);
cout << (good(mt[v]) ? "Mirko\n" : "Slavko\n");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
904 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
768 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |