Submission #197093

#TimeUsernameProblemLanguageResultExecution timeMemory
197093quocnguyen1012Commuter Pass (JOI18_commuter_pass)C++14
Compilation error
0 ms0 KiB
clude <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<ll, int> #define ull unsigned ll #define f first #define s second #define FOR(i,a,b) for (int i=(a); i<(b); ++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for (int i=(n-1); i>=0; --i) #define REP1(i,n) FOR(i,1,n+1) #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() #define SQ(x) (x)*(x) #define MN(a,b) a = min(a,(__typeof__(a))(b)) #define MX(a,b) a = max(a,(__typeof__(a))(b)) #define pb push_back #define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end())))) #ifdef BALBIT #define IOS() #define bug(...) fprintf(stderr,"#%d (%s) = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__); template<typename T> void _do(T &&x){cerr<<x<<endl;} template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);} #else #define IOS() ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' #define bug(...) #endif const int iinf = 1<<29; const ll inf = 1ll<<60; const ll mod = 1e9+7; void GG(){cout<<"-1\n"; exit(0);} ll mpow(ll a, ll n, ll mo = mod){ // a^n % mod ll re=1; while (n>0){ if (n&1) re = re*a %mo; a = a*a %mo; n>>=1; } return re; } ll inv (ll b, ll mo = mod){ if (b==1) return b; return (mo-mo/b) * inv(mo%b) % mo; } const int maxn = 1e5+5; vector<pii> g[maxn]; // to, weight. 1-based ll ds[maxn], dt[maxn], du[maxn], dv[maxn]; void dij(ll d[], int S){ priority_queue<pii, vector<pii>, greater<pii> > pq; // Distance, node fill(d, d+maxn, inf); d[S]=0; pq.push({0,S}); while (!pq.empty()) { ll w = pq.top().f, v = pq.top().s; pq.pop(); if (w != d[v]) { continue; } for (pii &e : g[v]) { if (d[e.f] > d[v] + e.s) { d[e.f] = d[v] + e.s; pq.push({d[e.f],e.f}); } } } } bool B[maxn]; // black ll mnu[maxn]; // Min distance to u walking on s-t shortest path signed main(){ IOS(); int n, m; cin>>n>>m; int s,t,u,v; cin>>s>>t>>u>>v; REP(i,m) { int a, b, c; cin>>a>>b>>c; g[a].pb({b,c}); g[b].pb({a,c}); } dij(ds,s); REP1(i,n) { bug(i, ds[i]); } dij(dt,t); dij(dv,v); dij(du,u); ll re = inf; ll tg = ds[t]; assert(tg == dt[s]); { vector<int> q; fill(mnu, mnu+maxn, inf); static int seen[maxn]; seen[s]=1; REP1(i,n) q.pb(i); sort(ALL(q), [](int a, int b){return ds[a]<ds[b];}); REP(i,n) { int at = q[i]; MN(mnu[at], du[at]); for (pii &e : g[at]) { int to = e.f; if (ds[at] + e.s + dt[to] == ds[t]) { MN(mnu[to], mnu[at]); } } bug(at,mnu[at],dv[at]); MN(re, mnu[at] + dv[at]); } } cout<<min(re, du[v])<<endl; }

Compilation message (stderr)

commuter_pass.cpp:1:1: error: 'clude' does not name a type
 clude <bits/stdc++.h>
 ^~~~~
commuter_pass.cpp: In function 'void GG()':
commuter_pass.cpp:35:11: error: 'cout' was not declared in this scope
 void GG(){cout<<"-1\n"; exit(0);}
           ^~~~
commuter_pass.cpp:35:25: error: 'exit' was not declared in this scope
 void GG(){cout<<"-1\n"; exit(0);}
                         ^~~~
commuter_pass.cpp: At global scope:
commuter_pass.cpp:54:1: error: 'vector' does not name a type
 vector<pii> g[maxn]; // to, weight. 1-based
 ^~~~~~
commuter_pass.cpp: In function 'void dij(long long int*, int)':
commuter_pass.cpp:58:5: error: 'priority_queue' was not declared in this scope
     priority_queue<pii, vector<pii>, greater<pii> > pq; // Distance, node
     ^~~~~~~~~~~~~~
commuter_pass.cpp:4:13: error: 'pair' was not declared in this scope
 #define pii pair<ll, int>
             ^
commuter_pass.cpp:58:20: note: in expansion of macro 'pii'
     priority_queue<pii, vector<pii>, greater<pii> > pq; // Distance, node
                    ^~~
commuter_pass.cpp:4:13: note: suggested alternative: 'pii'
 #define pii pair<ll, int>
             ^
commuter_pass.cpp:58:20: note: in expansion of macro 'pii'
     priority_queue<pii, vector<pii>, greater<pii> > pq; // Distance, node
                    ^~~
commuter_pass.cpp:3:12: error: expected primary-expression before 'long'
 #define ll long long
            ^
commuter_pass.cpp:4:18: note: in expansion of macro 'll'
 #define pii pair<ll, int>
                  ^~
commuter_pass.cpp:58:20: note: in expansion of macro 'pii'
     priority_queue<pii, vector<pii>, greater<pii> > pq; // Distance, node
                    ^~~
commuter_pass.cpp:59:5: error: 'fill' was not declared in this scope
     fill(d, d+maxn, inf);
     ^~~~
commuter_pass.cpp:59:5: note: suggested alternative: 'ull'
     fill(d, d+maxn, inf);
     ^~~~
     ull
commuter_pass.cpp:60:13: error: 'pq' was not declared in this scope
     d[S]=0; pq.push({0,S});
             ^~
commuter_pass.cpp:60:13: note: suggested alternative: 'pb'
     d[S]=0; pq.push({0,S});
             ^~
             pb
commuter_pass.cpp:64:20: error: 'v' was not declared in this scope
         if (w != d[v]) {
                    ^
commuter_pass.cpp:3:12: error: expected primary-expression before 'long'
 #define ll long long
            ^
commuter_pass.cpp:4:18: note: in expansion of macro 'll'
 #define pii pair<ll, int>
                  ^~
commuter_pass.cpp:67:14: note: in expansion of macro 'pii'
         for (pii &e : g[v]) {
              ^~~
commuter_pass.cpp:73:5: error: expected primary-expression before '}' token
     }
     ^
commuter_pass.cpp:73:5: error: expected ';' before '}' token
commuter_pass.cpp:73:5: error: expected primary-expression before '}' token
commuter_pass.cpp:73:5: error: expected ')' before '}' token
commuter_pass.cpp:73:5: error: expected primary-expression before '}' token
commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:25:15: error: 'ios_base' has not been declared
 #define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
               ^
commuter_pass.cpp:79:5: note: in expansion of macro 'IOS'
     IOS();
     ^~~
commuter_pass.cpp:25:44: error: 'cin' was not declared in this scope
 #define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
                                            ^
commuter_pass.cpp:79:5: note: in expansion of macro 'IOS'
     IOS();
     ^~~
commuter_pass.cpp:25:44: note: suggested alternative: 'main'
 #define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
                                            ^
commuter_pass.cpp:79:5: note: in expansion of macro 'IOS'
     IOS();
     ^~~
commuter_pass.cpp:85:9: error: 'g' was not declared in this scope
         g[a].pb({b,c});
         ^
commuter_pass.cpp:96:20: error: 'assert' was not declared in this scope
     ll tg = ds[t]; assert(tg == dt[s]);
                    ^~~~~~
commuter_pass.cpp:96:20: note: suggested alternative: 'short'
     ll tg = ds[t]; assert(tg == dt[s]);
                    ^~~~~~
                    short
commuter_pass.cpp:98:9: error: 'vector' was not declared in this scope
         vector<int> q;
         ^~~~~~
commuter_pass.cpp:98:16: error: expected primary-expression before 'int'
         vector<int> q;
                ^~~
commuter_pass.cpp:99:9: error: 'fill' was not declared in this scope
         fill(mnu, mnu+maxn, inf);
         ^~~~
commuter_pass.cpp:99:9: note: suggested alternative: 'ull'
         fill(mnu, mnu+maxn, inf);
         ^~~~
         ull
commuter_pass.cpp:102:19: error: 'q' was not declared in this scope
         REP1(i,n) q.pb(i);
                   ^
commuter_pass.cpp:103:18: error: 'q' was not declared in this scope
         sort(ALL(q), [](int a, int b){return ds[a]<ds[b];});
                  ^
commuter_pass.cpp:12:16: note: in definition of macro 'ALL'
 #define ALL(x) x.begin(),x.end()
                ^
commuter_pass.cpp:103:9: error: 'sort' was not declared in this scope
         sort(ALL(q), [](int a, int b){return ds[a]<ds[b];});
         ^~~~
commuter_pass.cpp:103:9: note: suggested alternative: 'short'
         sort(ALL(q), [](int a, int b){return ds[a]<ds[b];});
         ^~~~
         short
commuter_pass.cpp:15:21: error: 'min' was not declared in this scope
 #define MN(a,b) a = min(a,(__typeof__(a))(b))
                     ^
commuter_pass.cpp:106:13: note: in expansion of macro 'MN'
             MN(mnu[at], du[at]);
             ^~
commuter_pass.cpp:15:21: note: suggested alternative: 'main'
 #define MN(a,b) a = min(a,(__typeof__(a))(b))
                     ^
commuter_pass.cpp:106:13: note: in expansion of macro 'MN'
             MN(mnu[at], du[at]);
             ^~
commuter_pass.cpp:4:13: error: 'pair' was not declared in this scope
 #define pii pair<ll, int>
             ^
commuter_pass.cpp:107:18: note: in expansion of macro 'pii'
             for (pii &e : g[at]) {
                  ^~~
commuter_pass.cpp:4:13: note: suggested alternative: 'main'
 #define pii pair<ll, int>
             ^
commuter_pass.cpp:107:18: note: in expansion of macro 'pii'
             for (pii &e : g[at]) {
                  ^~~
commuter_pass.cpp:3:12: error: expected primary-expression before 'long'
 #define ll long long
            ^
commuter_pass.cpp:4:18: note: in expansion of macro 'll'
 #define pii pair<ll, int>
                  ^~
commuter_pass.cpp:107:18: note: in expansion of macro 'pii'
             for (pii &e : g[at]) {
                  ^~~
commuter_pass.cpp:114:37: error: expected ')' before ';' token
             MN(re, mnu[at] + dv[at]);
                                     ^
commuter_pass.cpp:119:5: error: 'cout' was not declared in this scope
     cout<<min(re, du[v])<<endl;
     ^~~~
commuter_pass.cpp:119:11: error: 'min' was not declared in this scope
     cout<<min(re, du[v])<<endl;
           ^~~
commuter_pass.cpp:119:11: note: suggested alternative: 'main'
     cout<<min(re, du[v])<<endl;
           ^~~
           main