Submission #1018668

#TimeUsernameProblemLanguageResultExecution timeMemory
1018668vjudge1Planinarenje (COCI18_planinarenje)C++17
32 / 160
117 ms860 KiB
#include<bits/stdc++.h> using namespace std; const int N = 5005 * 2; int n, m; vector<int> G[N]; bool seen[N]; bool dfs(int v) { seen[v] = true; bool dead = true, l = false; for(int u : G[v]) { if(seen[u]) continue; dead = false; bool s = dfs(u); // cerr << u << ' ' << s << endl; l |= !s; } if(dead) return false; return l; } int main() { cin >> n >> m; for(int i = 0; i < m ; i++) { int u, v; cin >> u >> v; v += n; G[u].push_back(v); G[v].push_back(u); } for(int i = 1; i <= n; i ++) { cout << (dfs(i) ? "Slavko" : "Mirko") << "\n"; for(int j = 1; j <= 2 * n; j ++) seen[j] = false; } 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...