# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846135 | 2023-09-07T11:29:23 Z | vjudge1 | KOVANICE (COI15_kovanice) | C++17 | 3 ms | 2652 KB |
#include <bits/stdc++.h> using namespace std; #pragma optimize "DostSeferoğlu" #pragma GCC optimize("unroll-loops,Ofast") #pragma GCC target("avx2,tune=native") #define int long long #define pii pair<int,int> #define bg begin #define vi vector<int> #define endl '\n' #define vvi vector<vi> #define vp vector<pii> #define sp << " " << #define ff first #define ss second #define brake {cout << "OK\n";return;} #define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;} #define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx) #define F(xx,yy) for (int xx=1;xx<=yy;++xx) #define pb push_back const int inf = 1e18; const int MOD = 998244353; const int N = 3e5+1; vi dad(N); int find(int x) { if (x == dad[x]) return x; return dad[x] = find(dad[x]); } void unite(int x,int y) { dad[find(x)] = find(y); } void solve() { int n,m,k; cin >> n >> m >> k; if (n == 2) { set<int> betters,worses; F(i,m) dad[i] = i; dad[0]=0; while (k--) { string s; cin >> s; string n1,n2; int seeneq = 0,seensm=0,seenbg=0; for (auto c : s) { if (c == '=') { seeneq = 1; continue; } if (c == '<') { seensm = 1; continue; } if (c == '>') { seenbg = 1; continue; } if (seeneq || seenbg || seensm) { n2+=c; }else n1+=c; } int x = stoi(n1); int y = stoi(n2); if (seeneq) { unite(x,y); } else if (seensm){ betters.insert(x); worses.insert(y); } else{ betters.insert(y); worses.insert(x); } } set<int> goods,bads; for (auto it : betters) goods.insert(find(it)); for (auto it : worses) bads.insert(find(it)); vi type(m+1); for (int i=1;i<=m;i++) { if (goods.count(find(i))) cout << "K1\n"; else if (bads.count(find(i))) cout << "K2\n"; else cout << "?\n"; } } } signed main() { ios_base::sync_with_stdio(0);cin.tie(0); #ifdef Local freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #else freopen("promote.in","r",stdin); freopen("promote.out","w",stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |