#include <bits/stdc++.h>
using namespace std;
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
const int N = 5e4 + 15;
int n, m, dp[N];
vector <int> g[N];
bool used[N];
void dfs(int v, int p = -1) {
used[v] = true;
for(int to : g[v]) {
if(!used[to])
dfs(to, v);
if(to != p) {
if(v > n) {
if(dp[to] == 1)
dp[v] = 1;
else if(!dp[v] && dp[to])
dp[v] = 2;
}
else {
if(dp[to] == 2)
dp[v] = 2;
else if(!dp[v] && dp[to])
dp[v] = 1;
}
}
}
if(!dp[v])
dp[v] = (v <= n ? 1 : 2);
}
int main() {
cin >> n >> m;
for(int i = 1; i <= m; ++i) {
int u, v;
cin >> u >> v;
g[u].pb(v + n);
g[v + n].pb(u);
}
for(int i = 1; i <= n; ++i) {
memset(used, 0, sizeof(used));
memset(dp, 0, sizeof(dp));
dfs(i);
if(dp[i] == 1)
puts("Mirko");
else
puts("Slavko");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1788 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1784 KB |
Output is correct |
2 |
Correct |
3 ms |
1784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1784 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1784 KB |
Output is correct |
2 |
Correct |
12 ms |
1784 KB |
Output is correct |
3 |
Correct |
10 ms |
1784 KB |
Output is correct |
4 |
Correct |
10 ms |
1656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
2100 KB |
Output is correct |
2 |
Correct |
70 ms |
2040 KB |
Output is correct |
3 |
Correct |
69 ms |
2108 KB |
Output is correct |
4 |
Correct |
91 ms |
2040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
1912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
1912 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
272 ms |
2040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
441 ms |
2168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
304 ms |
2040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |