Submission #1517893
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i=j; i<=k; i++) #define FFOR(i, j, k) for(int i=j; i<k; i++) #define DFOR(i, j, k) for(int i=j; i>=k; i--) #define bug(x) cerr<<#x<<" = "<<x<<'\n' #define pb push_back #define mp make_pair typedef long long ll; typedef long double ld; template <typename T> inline void read(T &x){ char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){ nega=1; c=getchar(); } x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x; } template <typename T> inline void writep(T x){ if(x>9) writep(x/10); putchar(x%10+48); } template <typename T> inline void write(T x){ if(x<0){ putchar('-'); x=-x; } writep(x); } template <typename T> inline void writeln(T x){ write(x); putchar('\n'); } #define taskname "D" ll x[100001]; int n; ll a, b; int main(){ #ifdef Megumin if(fopen(taskname".inp", "r")) freopen(taskname".inp", "r", stdin); #endif // Megumin read(n); read(a); read(b); FOR(i, 1, n) read(x[i]); ll ans=0; FOR(i, 2, n) ans+=min((x[i]-x[i-1])*a, b); writeln(ans); }
Submission Info
Submission Time | |
---|---|
Task | D - Walk and Teleport |
User | johntitor |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1259 Byte |
Status | AC |
Exec Time | 9 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 | 9 ms | 1024 KB |
subtask_1_balancedmax_02.txt | AC | 9 ms | 1024 KB |
subtask_1_max_01.txt | AC | 9 ms | 1024 KB |
subtask_1_max_02.txt | AC | 9 ms | 1024 KB |
subtask_1_min_01.txt | AC | 1 ms | 256 KB |
subtask_1_onlya_01.txt | AC | 5 ms | 640 KB |
subtask_1_onlyamax_01.txt | AC | 9 ms | 1024 KB |
subtask_1_onlyb_01.txt | AC | 3 ms | 384 KB |
subtask_1_onlybmax_01.txt | AC | 9 ms | 1024 KB |
subtask_1_rand_01.txt | AC | 6 ms | 768 KB |
subtask_1_rand_02.txt | AC | 8 ms | 896 KB |
subtask_1_rand_03.txt | AC | 4 ms | 512 KB |