Submission #3416523
Source Code Expand
#include<cstdio> using namespace std; int n; int A,B; long long ans=0; long long x[100100000]; long long y[100100000]; int main() { scanf("%d %d %d",&n,&A,&B); x[0]=0; for(int i=1;i<=n;i++) scanf("%d",&x[i]); for(int i=1;i<=n-1;i++) y[i]=x[i+1]-x[i]; for(int i=1;i<=n-1;i++) { if(y[i]*A<=B) ans+=y[i]*A; else ans+=B; } printf("%lld",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Walk and Teleport |
User | vjudge1 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 371 Byte |
Status | AC |
Exec Time | 13 ms |
Memory | 4992 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:13:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] scanf("%d",&x[i]); ^ ./Main.cpp:10:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d %d",&n,&A,&B); ^ ./Main.cpp:13:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&x[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_balancedmax_01.txt, subtask_1_balancedmax_02.txt, subtask_1_max_01.txt, subtask_1_max_02.txt, subtask_1_min_01.txt, subtask_1_onlya_01.txt, subtask_1_onlyamax_01.txt, subtask_1_onlyb_01.txt, subtask_1_onlybmax_01.txt, subtask_1_rand_01.txt, subtask_1_rand_02.txt, subtask_1_rand_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 2176 KB |
sample_02.txt | AC | 1 ms | 2176 KB |
sample_03.txt | AC | 1 ms | 2176 KB |
subtask_1_balancedmax_01.txt | AC | 13 ms | 4992 KB |
subtask_1_balancedmax_02.txt | AC | 13 ms | 4992 KB |
subtask_1_max_01.txt | AC | 13 ms | 4992 KB |
subtask_1_max_02.txt | AC | 13 ms | 4992 KB |
subtask_1_min_01.txt | AC | 1 ms | 2176 KB |
subtask_1_onlya_01.txt | AC | 7 ms | 4608 KB |
subtask_1_onlyamax_01.txt | AC | 13 ms | 4992 KB |
subtask_1_onlyb_01.txt | AC | 4 ms | 2432 KB |
subtask_1_onlybmax_01.txt | AC | 13 ms | 4992 KB |
subtask_1_rand_01.txt | AC | 8 ms | 4736 KB |
subtask_1_rand_02.txt | AC | 11 ms | 4864 KB |
subtask_1_rand_03.txt | AC | 5 ms | 2432 KB |