Submission #1080066


Source Code Expand

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <string.h>
#include <sstream>
#include <cctype>
#include <climits>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <vector>
#include <iterator>
#include <algorithm>
#include <stack>
#define _clr(x,y) memset(x,y,sizeof(x))
#define _inf(x) memset(x,0x3f,sizeof(x))
#define pb push_back
#define mp make_pair
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
typedef long long LL;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	#ifndef ONLINE_JUDGE
		//freopen("in.txt","r",stdin);
		//freopen("out.txt","w",stdout);
	#endif
	
	LL n,a,b,x[100000+5]={};
	LL ans=0;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++) cin>>x[i];
	for(int i=2;i<=n;i++)
	{
		ans+=min(b,a*(x[i]-x[i-1]));
	}
	cout<<ans<<endl;
    return 0;
}

Submission Info

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 12
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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 4 ms 1024 KB
sample_02.txt AC 4 ms 1024 KB
sample_03.txt AC 4 ms 1024 KB
subtask_1_balancedmax_01.txt AC 14 ms 1024 KB
subtask_1_balancedmax_02.txt AC 14 ms 1024 KB
subtask_1_max_01.txt AC 14 ms 1024 KB
subtask_1_max_02.txt AC 14 ms 1024 KB
subtask_1_min_01.txt AC 3 ms 1024 KB
subtask_1_onlya_01.txt AC 9 ms 1024 KB
subtask_1_onlyamax_01.txt AC 14 ms 1024 KB
subtask_1_onlyb_01.txt AC 6 ms 1024 KB
subtask_1_onlybmax_01.txt AC 14 ms 1024 KB
subtask_1_rand_01.txt AC 10 ms 1024 KB
subtask_1_rand_02.txt AC 12 ms 1024 KB
subtask_1_rand_03.txt AC 7 ms 1024 KB