#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 200101
#define M ll(1e9 + 7)
#define inf 1e9 + 1e9
using namespace std;
//using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
typedef short int si;
typedef array <int, 2> a2;
//typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int mt[N];
bool mkr[N];
vector <int> g[N];
bool kuna(int v)
{
if (mrk[v]) return 0;
mrk[v] = 1;
for (auto it : g[v])
if (mt[it] == -1 || kuna(mt[it])) {mt[it] = v; return 1;}
return 0;
}
bool gdr(int v)
{
if (mrk[v]) return 0;
mrk[v] = 1;
for (auto it : g[v])
if (mt[it] == -1 || gdr(mt[it])) return 1;
return 0;
}
int main()
{
//freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout);
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++)
{
int x, y;
cin >> x >> y;
y += n;
g[x].pb(y);
g[y].pb(x);
}
for (int i = 1; i <= n + n; i++) mt[i] = -1;
for (int i = 1; i <= n; i++)
{
memset(mrk, 0, sizeof(mrk));
kuna(i);
}
for (int i = 1; i <= n; i++)
if (mt[i] == -1) cout << "Mirko" << endl;
else
{
for (int j = 1; j <= n + n; j++) mkr[j] = 0;
bool gd = gdr(mt[i]);
if (gd) cout << "Mirko" << endl;
else cout << "Slavko" << endl;
}
}
Compilation message
planinarenje.cpp: In function 'bool kuna(int)':
planinarenje.cpp:37:9: error: 'mrk' was not declared in this scope
if (mrk[v]) return 0;
^~~
planinarenje.cpp:39:5: error: 'mrk' was not declared in this scope
mrk[v] = 1;
^~~
planinarenje.cpp: In function 'bool gdr(int)':
planinarenje.cpp:49:9: error: 'mrk' was not declared in this scope
if (mrk[v]) return 0;
^~~
planinarenje.cpp:51:5: error: 'mrk' was not declared in this scope
mrk[v] = 1;
^~~
planinarenje.cpp: In function 'int main()':
planinarenje.cpp:85:16: error: 'mrk' was not declared in this scope
memset(mrk, 0, sizeof(mrk));
^~~