Submission #1987131


Source Code Expand

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> x(ll);
  cin >> x[0];
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    cin >> x[i];
    ans += min((x[i] - x[i - 1]) * a, b);
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Walk and Teleport
User comethelp
Language C++14 (GCC 5.4.1)
Score 0
Code Size 354 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   cin >> x[0];
             ^
./Main.cpp:10:7: error: no match for ‘operator>>’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘std::vector<int>(ll) {aka std::vector<int>(long long int)}’)
   cin >> x[0];
       ^
In file included from /usr/include/c++/5/iostream:40:0,
                 from ./Main.cpp:1:
/usr/include/c++/5/istream:120:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match>
       operator>>(__istream_type& (*__pf)(__istream_type&))
       ^
/usr/include/c++/5/istream:120:7: note:   conversion of argument 1 would be ill-formed:
...