Submission #1120471

#TimeUsernameProblemLanguageResultExecution timeMemory
1120471vjudge1KOVANICE (COI15_kovanice)C++17
50 / 100
651 ms124132 KiB
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define pb push_back #define endl "\n" #define ALL(x) x.begin(), x.end() #define intt long long const intt mxN = 2e5 + 5; vector<vector<intt>>graph; vector<bool>visited(mxN, 0); vector<string>anss(mxN); void dfs(intt node, string s) { visited[node] = 1; anss[node] = s; for(auto u : graph[node]) { if(!visited[u]){ dfs(u, s); } } } void solve() { int n, m, v; cin >> n >> m >> v; map<char,intt> mp[m + 1]; graph.resize(m + 1); anss.resize(m + 1); for(int i = 1; i <= m; i++) { anss[i] = "?"; } map<intt,intt>k1, k2; vector<string>beraber; while(v--) { int a, c; char b; cin >> a >> b >> c; if(b == '=') { graph[a].pb(c); graph[c].pb(a); } else if(b == '<') { anss[a] = "K1"; anss[c] = "K2"; k1[a]++; k2[c]++; } else { anss[c] = "K1"; anss[a] = "K2"; k2[a]++; k1[c]++; } } for(int i = 1; i <= m; i++) { if(k1[i] > 0) { dfs(i, "K1"); } else if(k2[i] > 0) { dfs(i, "K2"); } } for(int i = 1; i <= m; i++) { cout << anss[i] << endl; } } int main(){ SPEED; int tst = 1, i = 1; // cin >> tst; while(tst--) { solve(); } return 0; }

Compilation message (stderr)

kovanice.cpp: In function 'int main()':
kovanice.cpp:77:18: warning: unused variable 'i' [-Wunused-variable]
   77 |     int tst = 1, i = 1;
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...