Submission #771523

# Submission time Handle Problem Language Result Execution time Memory
771523 2023-07-03T05:51:12 Z ttamx One-Way Streets (CEOI17_oneway) C++14
Compilation error
0 ms 0 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

oneway.cpp: In function 'void dfs(int)':
oneway.cpp:16:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   16 |     for(auto [v,i]:adj[u]){
      |              ^
oneway.cpp:21:45: error: expected primary-expression before ';' token
   21 |             if(val2[v]>0||!val[v])ans[i>>1]=;
      |                                             ^