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
Task D - Walk and Teleport
User iwashi31
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1142 Byte
Status
Exec Time 45 ms
Memory 1024 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 500 / 500 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 3 ms 256 KB
sample_02.txt 3 ms 256 KB
sample_03.txt 2 ms 256 KB
subtask_1_balancedmax_01.txt 42 ms 1024 KB
subtask_1_balancedmax_02.txt 42 ms 1024 KB
subtask_1_max_01.txt 43 ms 1024 KB
subtask_1_max_02.txt 43 ms 1024 KB
subtask_1_min_01.txt 3 ms 256 KB
subtask_1_onlya_01.txt 24 ms 640 KB
subtask_1_onlyamax_01.txt 45 ms 1024 KB
subtask_1_onlyb_01.txt 12 ms 384 KB
subtask_1_onlybmax_01.txt 43 ms 1024 KB
subtask_1_rand_01.txt 29 ms 768 KB
subtask_1_rand_02.txt 36 ms 896 KB
subtask_1_rand_03.txt 17 ms 512 KB