Submission #00066


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
signed main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n,m,ans=0;
cin>>n>>m;
vector<int> p(m+1);
for(int i=1;i<=m;i++){
cin>>p[i];
}
vector<vector<int>> load(n,vector<int>(5));
for(int i=1;i<=n-1;i++){
for(int j=1;j<=3;j++){
cin>>load[i][j];
}
}
vector<int> count(n,0);
for(int i=1;i<=m-1;i++){
for(int j=min(p[i],p[i+1]);j<max(p[i],p[i+1]);j++){
ans+=load[j][2];
if(count[j]<=0){
ans+=load[j][3];
}
count[j]++;
}
}
for(int i=1;i<=n-1;i++){
if(count[i]>0){
if(load[i][1]*count[i]<load[i][2]*count[i]+load[i][3]){
ans-=load[i][2]*count[i]+load[i][3];
ans+=load[i][1]*count[i];
}
}
}
cout<<ans<<'\n';
return 0;
}

ステータス

項目 データ
問題 0002 - 鉄道旅行
ユーザー名 ei2009
投稿日時 2020-12-08 18:18:22
言語 C++17
状態 Wrong Answer
得点 50
ソースコード長 965 Byte
最大実行時間 1000 ms
最大メモリ使用量 6976 KB

セット

セット 得点 Cases
1 Subtask01 20 / 20 01-*
2 Subtask02 30 / 30 sample-*, 01-*, 02-*
3 Subtask03 0 / 50 sample-*, 01-*, 02-*, 03-*

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 25 ms 600 KB
1
2
3
01-02.txt AC 21 ms 428 KB
1
2
3
01-03.txt AC 26 ms 476 KB
1
2
3
01-04.txt AC 18 ms 496 KB
1
2
3
01-05.txt AC 23 ms 432 KB
1
2
3
01-06.txt AC 17 ms 736 KB
1
2
3
01-07.txt AC 23 ms 760 KB
1
2
3
01-08.txt AC 21 ms 656 KB
1
2
3
02-01.txt AC 20 ms 680 KB
2
3
02-02.txt AC 24 ms 572 KB
2
3
02-03.txt AC 17 ms 592 KB
2
3
02-04.txt AC 21 ms 740 KB
2
3
02-05.txt AC 26 ms 632 KB
2
3
02-06.txt AC 23 ms 644 KB
2
3
02-07.txt AC 18 ms 536 KB
2
3
02-08.txt AC 21 ms 428 KB
2
3
02-09.txt AC 25 ms 564 KB
2
3
02-10.txt AC 23 ms 712 KB
2
3
03-01.txt WA 81 ms 6620 KB
3
03-02.txt TLE 1000 ms 6976 KB
3
03-03.txt TLE 1000 ms 6944 KB
3
03-04.txt WA 80 ms 6528 KB
3
03-05.txt TLE 1000 ms 6884 KB
3
03-06.txt TLE 1000 ms 6848 KB
3
03-07.txt TLE 1000 ms 6560 KB
3
03-08.txt TLE 1000 ms 6848 KB
3
03-09.txt TLE 1000 ms 6816 KB
3
03-10.txt TLE 1000 ms 6524 KB
3
03-11.txt TLE 1000 ms 6808 KB
3
03-12.txt TLE 1000 ms 6908 KB
3
03-13.txt TLE 1000 ms 6876 KB
3
03-14.txt TLE 1000 ms 6844 KB
3
sample-01.txt AC 21 ms 544 KB
2
3
sample-02.txt AC 18 ms 624 KB
2
3