# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99141 | 2019-02-28T20:27:36 Z | rzbt | Stove (JOI18_stove) | C++14 | 3 ms | 384 KB |
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define F first #define S second #define all(x) x.begin(),x.end() #define MAXN 100005 typedef long long ll; using namespace std; int n,k; int niz[MAXN]; vector<int> razmaci; int main() { scanf("%d %d", &n, &k); for(int i=1;i<=n;i++) scanf("%d", niz+i); sort(niz+1,niz+1+n); for(int i=2;i<=n;i++){ razmaci.pb(niz[i]-niz[i-1]-1); } int res=niz[n]-niz[1]; for(int i=0;i<k-1;i++)res-=razmaci[i]; printf("%d",res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |