# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
771524 | 2023-07-03T05:51:54 Z | ttamx | One-Way Streets (CEOI17_oneway) | C++14 | 1 ms | 2644 KB |
#include<bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") using namespace std; const int N=1e5+5; int n,m,p; int val[N],val2[N]; char ans[N]; vector<pair<int,int>> adj[N]; bool vis[N],used[N]; void dfs(int u){ vis[u]=true; for(auto [v,i]:adj[u]){ if(used[i>>1])continue; used[i>>1]=true; if(!vis[v]){ dfs(v); if(val2[v]>0||!val[v])ans[i>>1]; else ans[i>>1]=((val[v]>0)^(i&1))?'L':'R'; val[u]+=val[v]; val2[u]+=val2[v]; }else{ ans[i>>1]='B'; val2[u]++; val2[v]--; } } } int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> m; for(int i=1;i<=m;i++){ int u,v; cin >> u >> v; adj[u].emplace_back(v,i<<1); adj[v].emplace_back(u,i<<1|1); } cin >> p; for(int i=1;i<=p;i++){ int u,v; cin >> u >> v; val[u]++; val[v]--; } for(int i=1;i<=n;i++)if(!vis[i])dfs(i); for(int i=1;i<=m;i++)cout << ans[i]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2644 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |