Submission #00378


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#define INF 999999
#define ROOP(i,n) for(int i=1;i<=n;i++)
using namespace std;
int N,M,A,B,prev[3000][3000];
long long G[3000][3000],ans=0;
int sp=0,stack[3000];
void warshall_froyd(){
ROOP(i,N){
ROOP(j,N){
prev[i][j]=i;
}
}
ROOP(k,N){
ROOP(i,N){
ROOP(j,N){
if(G[i][j]>G[i][k]+G[k][j]){
G[i][j]=G[i][k]+G[k][j];
prev[i][j]=prev[k][j];
}
}
}
}
}
void get_path(int s,int g){
for(int cur=g;cur!=s;cur=prev[s][cur]){
stack[sp++]=cur;
}
stack[sp++]=s;
}
int main(){
scanf("%d %d %d %d",&N,&M,&A,&B);
ROOP(i,N) ROOP(j,N) G[i][j]=INF;
ROOP(i,N) G[i][i]=0;
ROOP(i,M){
int u,v,t;
scanf(" %d %d %d",&u,&v,&t);
G[u][v]=t;G[v][u]=t;
}
warshall_froyd();
get_path(A,B);
ROOP(i,N){
int MIN=INF;
for(int j=0;j<sp;j++){
MIN=min(MIN,G[i][stack[j]]);
}
ans+=MIN;
}
printf("%lld\n",ans);
return 0;
}

ステータス

項目 データ
問題 0004 - railway
ユーザー名 nii
投稿日時 2017-11-26 14:58:35
言語 C++
状態 Compile Error
得点 0
ソースコード長 1056 Byte
最大実行時間 -
最大メモリ使用量

コンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:48:33: error: no matching function for call to ‘min(int&, long long int&)’
       MIN=min(MIN,G[i][stack[j]]);
                                 ^
In file included from /usr/local/gcc-5.1.0/include/c++/5.1.0/bits/char_traits.h:39:0,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/ios:40,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/ostream:38,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/iostream:39,
                 from ./Main.cpp:1:
/usr/local/gcc-5.1.0/include/c++/5.1.0/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/local/gcc-5.1.0/include/c++/5.1.0/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
./Main.cpp:48:33: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
       MIN=min(MIN,G[i][stack[j]]);
                                 ^
In file included from /usr/local/gcc-5.1.0/include/c++/5.1.0/bits/char_traits.h:39:0,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/ios:40,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/ostream:38,
                 from /usr/local/gcc-5.1.0/include/c++/5.1.0/iostream:39,
                 from ./Main.cpp:1:
/usr/local/gcc-5.1.0/include/c++/5.1.0/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/local/gcc-5.1.0/include/c++/5.1.0/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
./Main.cpp:48:33: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
       MIN=min(MIN,G[i][stack[j]]);
                                 ^

セット

セット 得点 Cases

テストケース

ファイル名 状態 実行時間 メモリ使用量 #