Submission #1065561
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007;
#define pi 3.14159265358979323846264
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vl vector <long long>
#define vpii vector <pair <int, int> >
#define ll long long
#define fi first
#define se second
ll n, a, b, ar[100005];
ll ans;
int main() {
scanf("%lld %lld %lld", &n, &a, &b);
for (int i=1;i<=n;i++) scanf("%lld", &ar[i]);
for (int i=2;i<=n;i++) ans+=min((ar[i]-ar[i-1])*a, b);
printf("%lld\n", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Walk and Teleport |
User |
leekc |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
584 Byte |
Status |
AC |
Exec Time |
15 ms |
Memory |
1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:17:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld %lld", &n, &a, &b);
^
./Main.cpp:18:49: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i=1;i<=n;i++) scanf("%lld", &ar[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 |
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 |
2 ms |
256 KB |
sample_02.txt |
AC |
2 ms |
256 KB |
sample_03.txt |
AC |
2 ms |
256 KB |
subtask_1_balancedmax_01.txt |
AC |
14 ms |
1024 KB |
subtask_1_balancedmax_02.txt |
AC |
15 ms |
1024 KB |
subtask_1_max_01.txt |
AC |
15 ms |
1024 KB |
subtask_1_max_02.txt |
AC |
15 ms |
1024 KB |
subtask_1_min_01.txt |
AC |
2 ms |
256 KB |
subtask_1_onlya_01.txt |
AC |
8 ms |
640 KB |
subtask_1_onlyamax_01.txt |
AC |
14 ms |
1024 KB |
subtask_1_onlyb_01.txt |
AC |
5 ms |
384 KB |
subtask_1_onlybmax_01.txt |
AC |
14 ms |
1024 KB |
subtask_1_rand_01.txt |
AC |
10 ms |
768 KB |
subtask_1_rand_02.txt |
AC |
12 ms |
896 KB |
subtask_1_rand_03.txt |
AC |
7 ms |
512 KB |