Submission #488446

# Submission time Handle Problem Language Result Execution time Memory
488446 2021-11-18T23:01:57 Z SirCovidThe19th One-Way Streets (CEOI17_oneway) C++17
0 / 100
1 ms 2680 KB
#include <bits/stdc++.h>
using namespace std;

const int mx = 1e5 + 5;

int n, m, q, edgIn[mx], active[mx], actQRY[mx], ans[mx]; bool vis[mx]; vector<pair<int, int>> adj[mx]; 

void dfs(int cur, int p){
    vis[cur] = 1;
    for (auto [nxt, id] : adj[cur]) if (nxt != p){
        if (!vis[nxt]){
            dfs(nxt, cur); 
            active[cur] += active[nxt]; 
            if (!active[nxt]) ans[id] = actQRY[nxt]; //current edg is bridge
            actQRY[cur] += actQRY[nxt];
        }
        else edgIn[nxt]++, active[cur]++;
    }
    active[cur] -= edgIn[cur];
}

int main(){
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int a, b; cin >> a >> b;
        adj[a].push_back({b, i}); adj[b].push_back({a, i});
    }
    cin >> q;
    for (int i = 1; i <= q; i++){
        int a, b; cin >> a >> b;
        actQRY[a]++; actQRY[b]--;
    }
    for (int i = 1; i <= n; i++) if (!vis[i]) dfs(i, 0);
    for (int i = 1; i <= m; i++) cout<<(!ans[i] ? "B" : (ans[i] == -1 ? "L" : "R"));
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -