Submission #1120450

#TimeUsernameProblemLanguageResultExecution timeMemory
1120450vjudge1KOVANICE (COI15_kovanice)C++17
50 / 100
322 ms27208 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> using namespace std; const ll INF =1e18, mod = 1e9 + 7, N = 3e5 + 5; ll vx[N]; vector<ll>g[N]; vector<ll>used(N, 0); void dfs(ll s,ll w){ used[s] = 1; vx[s] = w; for(auto i : g[s]){ if(!used[i]){ dfs(i,w); } } } void solve(){ ll n,m,v; cin >> n >> m >> v; set<ll>s; while(v--){ ll x,y; char c; cin >> x >> c >> y; if(c == '<'){ vx[x] = 1; vx[y] = 2; s.in(x); s.in(y); } else{ g[x].pb(y); g[y].pb(x); } } for(auto i : s){ if(used[i] == 0){ dfs(i,vx[i]); } } for(int i = 1; i <= m; i++){ if(vx[i] == 0){ cout << "?" << endl; } else{ cout << "K" << vx[i] << endl; } } } int main(){ fast; solve(); 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...