Submission #990580

#TimeUsernameProblemLanguageResultExecution timeMemory
990580StuckOnAStove (JOI18_stove)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vi v(n), vd(n - 1); input(v); for (int i = 0; i < n - 1; i++) vd[i] = v[i + 1] - v[i] - 1; sort(rall(vd)); int sum = 0; for (int i = 0; i < k - 1; i++) sum += vd[i]; cout << *max_element(all(v)) - sum << endl; return 0; }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:7:2: error: 'vi' was not declared in this scope
    7 |  vi v(n), vd(n - 1);
      |  ^~
stove.cpp:8:8: error: 'v' was not declared in this scope
    8 |  input(v);
      |        ^
stove.cpp:8:2: error: 'input' was not declared in this scope
    8 |  input(v);
      |  ^~~~~
stove.cpp:10:3: error: 'vd' was not declared in this scope
   10 |   vd[i] = v[i + 1] - v[i] - 1;
      |   ^~
stove.cpp:11:12: error: 'vd' was not declared in this scope
   11 |  sort(rall(vd));
      |            ^~
stove.cpp:11:7: error: 'rall' was not declared in this scope
   11 |  sort(rall(vd));
      |       ^~~~
stove.cpp:15:23: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   15 |  cout << *max_element(all(v)) - sum << endl;
      |                       ^~~
      |                       std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from stove.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~