Submission #1315116


Source Code Expand

#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

ll n, a, b;
vl x;
ll ans = 0;

int main(){
  cin >> n >> a >> b;
  x.resize(n);
  rep(i, n){
    cin >> x[i];
    if(i == 0) continue;
    if((x[i] - x[i-1]) * a < b) ans += (x[i] - x[i-1]) * a;
    else ans += b;
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Walk and Teleport
User tapuinu
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1205 Byte
Status AC
Exec Time 41 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 15
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 41 ms 1024 KB
subtask_1_balancedmax_02.txt AC 41 ms 1024 KB
subtask_1_max_01.txt AC 41 ms 1024 KB
subtask_1_max_02.txt AC 40 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