Submission #237567

#TimeUsernameProblemLanguageResultExecution timeMemory
237567VEGAnnPlaninarenje (COCI18_planinarenje)C++14
0 / 160
46 ms904 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...