Submission #1985951


Source Code Expand

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

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong n, a, b;
  scanf("%d %d %d", &n, &a, &b);

  vector<int> v;
  SV(n,v);

  llong ans = 0;
  REP(i,n - 1){
    ans += min(b, (v[i + 1] - v[i]) * a);
  }

  printf("%lld\n", ans);
  return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:42:31: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   scanf("%d %d %d", &n, &a, &b);
                               ^
./Main.cpp:42:31: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
./Main.cpp:42:31: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
./Main.cpp:42:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &n, &a, &b);
                                ^
./Main.cpp:30:63: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}
                                                               ^
./Main.cpp:45:3: note: in expansion ...

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 13 ms 892 KB
subtask_1_balancedmax_02.txt AC 13 ms 892 KB
subtask_1_max_01.txt AC 13 ms 892 KB
subtask_1_max_02.txt AC 13 ms 892 KB
subtask_1_min_01.txt AC 1 ms 256 KB
subtask_1_onlya_01.txt AC 7 ms 640 KB
subtask_1_onlyamax_01.txt AC 13 ms 892 KB
subtask_1_onlyb_01.txt AC 4 ms 512 KB
subtask_1_onlybmax_01.txt AC 13 ms 892 KB
subtask_1_rand_01.txt AC 8 ms 640 KB
subtask_1_rand_02.txt AC 11 ms 892 KB
subtask_1_rand_03.txt AC 5 ms 640 KB