Submission #1120823

#TimeUsernameProblemLanguageResultExecution timeMemory
1120823vjudge1KOVANICE (COI15_kovanice)C++17
0 / 100
355 ms205504 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n"; #define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; vector<queue<ll>>ve(300001); ll a[300000]; void upd(ll x) { while(!(ve[x].empty())) { if(a[ve[x].front()]==-1) { a[ve[x].front()]=a[x]; upd(ve[x].front()); } ve[x].pop(); } } int main() { ll n,m,v,i,j; cin>>n>>m>>v; for(i=0;i<m;i++) a[i]=-1; ll x,y; char d; for(i=0;i<v;i++) { cin>>x>>d>>y; x--; y--; if(d=='<') { a[x]=1; a[y]=2; upd(x); upd(y); } else { if(a[x]!=-1) a[y]=a[x]; else if(a[y]!=-1) a[x]=a[y]; else { ve[x].push(y); ve[y].push(x); } } } for(i=0;i<m;i++) { if(a[i]==-1) cout<<"?\n"; else cout<<"K"<<a[i]<<endl; } }

Compilation message (stderr)

kovanice.cpp: In function 'int main()':
kovanice.cpp:22:16: warning: unused variable 'j' [-Wunused-variable]
   22 |     ll n,m,v,i,j;
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...