Submission #117059

# Submission time Handle Problem Language Result Execution time Memory
117059 2019-06-14T14:33:40 Z JohnTitor 007 (CEOI14_007) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=(j); i<=(k); i++)
#define FFOR(i, j, k) for(int i=(j); i<(k); i++)
#define DFOR(i, j, k) for(int i=(j); i>=(k); i--)
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'
#define pb push_back
#define mp make_pair
#define bit(s, i) (((s)>>(i))&1LL)
#define mask(i) ((1LL<<(i)))
#define builtin_popcount __builtin_popcountll
#define __builtin_popcount __builtin_popcountll
using ll=long long; using ld=long double;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const ld pi=acos(0)*2;
template <typename T> inline void read(T &x){char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){nega=1; c=getchar();} x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10); putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){ putchar('-'); x=-x;} writep(x);}
template <typename T> inline void writeln(T x){write(x); putchar('\n');}
#define taskname "007"
int n, m;
int s, d, a, b;
int sa, sb, da, db;
int wa, wb;
int fa[200001];
bool donea[200001];
int fb[200001];
bool doneb[200001];
vector <int> g[200001];
queue <int> q;
void bfs(int s, int *f, bool *done){
    FOR(i, 1, n) done[i]=0;
    f[s]=0;
    done[s]=1;
    q.push(s);
    while(!q.empty()){
        s=q.front();
        q.pop();
        for(int v: g[s]) if(!done[v]){
            done[v]=1
            f[v]=f[s]+1;
            q.push(v);
        }
    }
}
int main(){
    #ifdef Aria
        if(fopen(taskname".in", "r"))
            freopen(taskname".in", "r", stdin);
    #endif // Aria
    read(n);
    read(m);
    read(s);
    read(d);
    read(a);
    read(b);
    {
        int u, v;
        FOR(i, 1, m){
            read(u);
            read(v);
        }
    }
    bfs(a, fs, donea);
    bfs(b, fb, doneb);
    sa=fa[s];
    da=fa[d];
    sb=fb[s];
    db=fb[d];
    wa=sa-da;
    wb=sb-db;
    if(wa<0||sb<0){
        puts("-1");
        return 0;
    }
    else if(wa!=wb){
        writeln(min(wa, wb));
    }
    else{
        writeln(wa-1);
    }
}

Compilation message

007.cpp: In function 'void bfs(int, int*, bool*)':
007.cpp:40:13: error: expected ';' before 'f'
             f[v]=f[s]+1;
             ^
007.cpp: In function 'int main()':
007.cpp:63:12: error: 'fs' was not declared in this scope
     bfs(a, fs, donea);
            ^~
007.cpp:63:12: note: suggested alternative: 'bfs'
     bfs(a, fs, donea);
            ^~
            bfs