Submission #82469

#TimeUsernameProblemLanguageResultExecution timeMemory
82469hatuank97lhpCommuter Pass (JOI18_commuter_pass)C++17
0 / 100
8 ms2108 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; LL n,m,A,B,C,D,a[305][305], res, oo = 1e15; int main() { //freopen(".inp","r",stdin); cin >> n >> m >> A >> B >> C >> D; for(int i = 1; i <= n; ++ i) { for(int j = 1; j <= m; ++ j) if( i != j ) a[i][j] = oo; } LL u,v,w; for(int i = 1; i <= m ;++ i) { cin >> u >> v >> w; a[u][v] = a[v][u] = min( a[u][v], w ); } for(int u = 1; u <= n; ++ u) { for(int i = 1; i <= n; ++ i) { for(int j = 1; j <= n; ++ j) a[i][j] - min( a[i][u] + a[u][j], a[i][j] ); } } res = oo; for(int i = 1; i <= n; ++ i) { for(int j = 1; j <= n; ++ j) { if( a[A][i] + a[i][j] + a[j][B] ) { res= min( res, a[C][i] + a[j][D] ); } } } cout << res; return 0; }

Compilation message (stderr)

commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:20:50: warning: value computed is not used [-Wunused-value]
             for(int j = 1; j <= n; ++ j) a[i][j] - min( a[i][u] + a[u][j], a[i][j] );
                                          ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...