Submission #466219

# Submission time Handle Problem Language Result Execution time Memory
466219 2021-08-18T11:21:15 Z AmirElarbi Senior Postmen (BOI14_postmen) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e7
#define unsigned u
#define eps 1e-18
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MAX_A 100005
#define V 450
#define re register
#define maxi(a,b) ((a) > (b) ? (a) : (b))
using namespace std;
vii adj[500005];
bool vis[500005];
int tv[500005];
int n,m,used;
int parent[500005];
void dfs(int u){
    if(tv[u]){
        while(tv[u]){
            cout << u << " ";
            tv[u] = 0;
            u = parent[u];
        }
        cout << endl;
    }
    for(!adj[u].empty()){
        ii x =adj[u].back();
        adj[u].pop_back();
        if(!vis[x.se]){
            vis[x.se] = 1;
            tv[u] = 1;
            parent[u] = x.fi;
            dfs(x.fi);
        }
    }
}
int main(){
    optimise;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int a,b;
        cin >> a >>b;
        adj[a].pb({b,i});
        adj[b].pb({a,i});
    }
    dfs(1);
}

Compilation message

postmen.cpp: In function 'void dfs(int)':
postmen.cpp:41:24: error: expected ';' before ')' token
   41 |     for(!adj[u].empty()){
      |                        ^
      |                        ;
postmen.cpp:51:1: error: expected primary-expression before '}' token
   51 | }
      | ^
postmen.cpp:50:6: error: expected ';' before '}' token
   50 |     }
      |      ^
      |      ;
   51 | }
      | ~     
postmen.cpp:51:1: error: expected primary-expression before '}' token
   51 | }
      | ^
postmen.cpp:50:6: error: expected ')' before '}' token
   50 |     }
      |      ^
      |      )
   51 | }
      | ~     
postmen.cpp:41:8: note: to match this '('
   41 |     for(!adj[u].empty()){
      |        ^
postmen.cpp:51:1: error: expected primary-expression before '}' token
   51 | }
      | ^