Submission #939293

#TimeUsernameProblemLanguageResultExecution timeMemory
939293vjudge1Commuter Pass (JOI18_commuter_pass)C++17
0 / 100
28 ms2140 KiB
#include <bits/stdc++.h> #pragma optimize("Ofast") #pragma target("avx2") using namespace std; #define ll long long #define ld long double #define pb push_back #define pf push_front #define pii pair<int,int> #define all(v) v.begin(),v.end() #define F first #define S second #define mem(a,i) memset(a,i,sizeof(a)) #define sz(s) (int)s.size() #define y1 yy #define ppb pop_back #define lb lower_bound #define ub upper_bound #define gcd(a,b) __gcd(a,b) #define in insert #define int ll const int MAX=300+15; const int B=2e5; const int N=104; const int block=450; const int maxB=MAX/B+10; const ll inf=1e18; const int mod=1e9+7; const int mod1=1e9+9; const ld eps=1e-9; int dx[8]={1,0,-1,0,1,-1,-1,1}; int dy[8]={0,1,0,-1,1,-1,1,-1}; int binpow(int a,int n){ if(!n)return 1; if(n%2==1)return a*binpow(a,n-1); int k=binpow(a,n/2); return k*k; } int n,m; int s,t,u,v; int d[MAX][MAX]; void solve(){ cin>>n>>m; cin>>s>>t>>u>>v; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i!=j)d[i][j]=inf; } } for(int i=1;i<=m;i++){ int x,y,z; cin>>x>>y>>z; d[x][y]=d[y][x]=z; } for(int k=1;k<=n;k++){ for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ d[i][j]=min(d[i][j],d[i][k]+d[k][j]); } } } // cout<<d[u][v]<<"\n"; int ans=inf; for(int x=1;x<=n;x++){ for(int y=1;y<=n;y++){ if(d[s][x]+d[x][y]+d[y][t]==d[s][t])ans=min(ans,min(d[v][x]+d[y][u],d[u][x]+d[y][v])); } } cout<<ans; } //1010 //0011 signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // prec(); int t=1; // cin>>t; while(t--)solve(); }

Compilation message (stderr)

commuter_pass.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize("Ofast")
      | 
commuter_pass.cpp:4: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
    4 | #pragma target("avx2")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...