Submission #540455

#TimeUsernameProblemLanguageResultExecution timeMemory
540455browntoadCommuter Pass (JOI18_commuter_pass)C++14
0 / 100
60 ms15148 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("Ofast", "unroll-loops") using namespace std; #define ll long long #define int ll #define FOR(i,a,b) for (int i = (a); i<(b); i++) #define REP(i,n) FOR(i,0,n) #define REP1(i,n) FOR(i,1,n+1) #define RREP(i,n) for (int i=(n)-1; i>=0; i--) #define RREP1(i,n) for (int i=(n); i>=1; i--) #define f first #define s second #define pb push_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)(x.size()) #define SQ(x) (x)*(x) #define pii pair<int, int> #define pdd pair<double ,double> #define pcc pair<char, char> #define endl '\n' //#define TOAD #ifdef TOAD #define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl #define IOS() #else #define bug(...) #define IOS() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #endif const ll inf = 1ll<<60; const int iinf=2147483647; const ll mod = 1e9+7; const ll maxn=1e5+5; const double PI=acos(-1); ll pw(ll x, ll p, ll m=mod){ ll ret=1; while (p>0){ if (p&1){ ret*=x; ret%=m; } x*=x; x%=m; p>>=1; } return ret; } ll inv(ll a, ll m=mod){ return pw(a,m-2); } //======================================================================================= int n, m, s, t, u, v; struct edge{ int st, en; int w; }; vector<edge> ing[maxn], graph[maxn]; vector<edge> E(2*maxn); vector<int> dis(maxn), rdis(maxn); vector<bool> ds1(maxn), ds2(maxn), ds3(maxn); void dij1(){ priority_queue<pii, vector<pii>, greater<pii> > pq; pq.push({0, s}); dis[s]=0; ds1[s]=1; while(pq.size()){ pii x=pq.top(); pq.pop(); if (ds1[x.s]) continue; ds1[x.s]=1; dis[x.s]=x.f; REP(i,SZ(ing[x.s])){ pq.push({x.f+ing[x.s][i].w, ing[x.s][i].en}); } } } void dij2(){ priority_queue<pii, vector<pii>, greater<pii> > pq; pq.push({0, t}); rdis[t]=0; ds2[t]=1; while(pq.size()){ pii x=pq.top(); pq.pop(); if (ds2[x.s]) continue; ds2[x.s]=1; rdis[x.s]=x.f; REP(i,SZ(ing[x.s])){ pq.push({x.f+ing[x.s][i].w, ing[x.s][i].en}); } } } signed main (){ IOS(); cin>>n>>m>>s>>t>>u>>v; REP(i,m){ cin>>E[i].st>>E[i].en>>E[i].w; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...