Submission #1592668
Source Code Expand
#include "bits/stdc++.h"
using namespace std;
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
int main() {
ll n, a, b, i, j;
cin >> n >> a >> b;
vl x(n);
for (i = 0; i < n; i++) {
cin >> x[i];
}
ll ans = 0;
for (i = 1; i < n; i++) {
if ((x[i] - x[i - 1])*a < b) {
ans += (x[i] - x[i - 1])*a;
}
else {
ans += b;
}
}
cout << ans << endl;
}
Submission Info
Submission Time |
|
Task |
D - Walk and Teleport |
User |
fuppy0716 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1038 Byte |
Status |
AC |
Exec Time |
41 ms |
Memory |
1024 KB |
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 |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |
subtask_1_balancedmax_01.txt |
AC |
40 ms |
1024 KB |
subtask_1_balancedmax_02.txt |
AC |
40 ms |
1024 KB |
subtask_1_max_01.txt |
AC |
40 ms |
1024 KB |
subtask_1_max_02.txt |
AC |
41 ms |
1024 KB |
subtask_1_min_01.txt |
AC |
1 ms |
256 KB |
subtask_1_onlya_01.txt |
AC |
21 ms |
640 KB |
subtask_1_onlyamax_01.txt |
AC |
41 ms |
1024 KB |
subtask_1_onlyb_01.txt |
AC |
11 ms |
384 KB |
subtask_1_onlybmax_01.txt |
AC |
41 ms |
1024 KB |
subtask_1_rand_01.txt |
AC |
26 ms |
768 KB |
subtask_1_rand_02.txt |
AC |
34 ms |
896 KB |
subtask_1_rand_03.txt |
AC |
16 ms |
512 KB |