Submission #676342

# Submission time Handle Problem Language Result Execution time Memory
676342 2022-12-30T12:22:03 Z stevancv One-Way Streets (CEOI17_oneway) C++14
0 / 100
2 ms 2644 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 1e5 + 2;
const ll linf = 1e18;
vector<array<int, 3>> g[N];
int a[N], dep[N], mn[N], ans[N];
void Dfs(int s, int e, int d) {
    dep[s] = mn[s] = d;
    for (auto u : g[s]) {
        if (u[1] == e) continue;
        if (dep[u[0]] == 0) {
            Dfs(u[0], u[1], d + 1);
            if (mn[u[0]] > dep[s]) {
                if (a[u[0]] > 0) ans[u[1]] = u[2] ^ 1;
                else if (a[u[0]] < 0) ans[u[1]] = u[2];
            }
            a[s] += a[u[0]];
            smin(mn[s], mn[u[0]]);
        }
        else smin(mn[s], dep[u[0]]);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back({v, i, 0});
        g[v].push_back({u, i, 1});
    }
    for (int i = 0; i < m; i++) ans[i] = 2;
    int p; cin >> p;
    for (int i = 0; i < p; i++) {
        int u, v;
        cin >> u >> v;
        a[u] += 1;
        a[v] -= 1;
    }
    Dfs(1, -1, 1);
    for (int i = 0; i < m; i++) {
        if (ans[i] == 0) cout << 'R';
        if (ans[i] == 1) cout << 'L';
        if (ans[i] == 2) cout << 'B';
    }
    cout << en;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -