Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #1065944

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
v.resize(n);
for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
int N, A, B;
cin >> N >> A >> B;

vector<int> X;
inputVector(X, N);

int ret = 0;

rep(i, N - 1) {
ret += min(A * (X[i + 1] - X[i]), B);
}
cout << ret << endl;

return 0;
}
```

Submission Info

Submission Time 2017-01-15 21:20:35+0900 D - Walk and Teleport iwashi31 C++14 (GCC 5.4.1) 500 1142 Byte AC 45 ms 1024 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt 3 ms 256 KB
sample_02.txt 3 ms 256 KB
sample_03.txt 2 ms 256 KB