Submission #488445

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

const int mx = 1e5 + 5;

int n, m, p, 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 >> p;
    for (int i = 1; i <= p; i++){
        int a, b; cin >> a >> b;
        actQRY[a]++; actQRY[b]--;
    }
    dfs(1, 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 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -