Submission #978245

#TimeUsernameProblemLanguageResultExecution timeMemory
978245PkiraXStove (JOI18_stove)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 1e5+5; ll n,k; ll val; ll x[N]; priority_queue <ll> pq; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for(int i=1;i<=n;i++) cin >> x[i]; sort(x+1,x+1+n); for(int i=1;i<n;i++) 3{ pq.push(x[i+1] - (x[i]+1)); } val = (x[n] - x[1]) + 1; for(int i=1;i<=k-1;i++){ val -= pq.top(); pq.pop(); } cout << val; }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:15:27: error: expected ';' before '{' token
   15 |     for(int i=1;i<n;i++) 3{
      |                           ^
      |                           ;
stove.cpp:15:26: warning: statement has no effect [-Wunused-value]
   15 |     for(int i=1;i<n;i++) 3{
      |                          ^