제출 #1120232

#제출 시각아이디문제언어결과실행 시간메모리
1120232vjudge1KOVANICE (COI15_kovanice)C++17
0 / 100
105 ms16524 KiB
// author - alimammadzade #include <bits/stdc++.h> using namespace std; const int M = 3e5 + 1; vector<int> g[M]; bool vis[M]; int res[M], n, m, v, a, b, k1, k2; void dfs(int u, int color) { res[u] = color; vis[u] = 1; for (int v : g[u]) if (!vis[v]) dfs(v, color); } signed main() { cin.tie(nullptr)->sync_with_stdio(false); // system("cls"), freopen("in.txt", "r", stdin); cin >> n >> m >> v; while (v--) { char c; cin >> a >> c >> b; if (c == '=') { g[a].push_back(b); g[b].push_back(a); } else if (c == '<') { k1 = a; k2 = b; } } if (k1) dfs(k1, 1); if (k2) dfs(k2, 2); for (int i = 1; i <= m; i++) if (res[i]) cout << "K" << res[i] << '\n'; else cout << "?\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...