# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51937 | 2018-06-22T17:05:35 Z | TadijaSebez | Stove (JOI18_stove) | C++11 | 37 ms | 10652 KB |
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; const int N=100050; int t[N]; int main() { int n,k,i; scanf("%i %i",&n,&k); for(i=1;i<=n;i++) scanf("%i",&t[i]); sort(t+1,t+1+n); vector<int> del; for(i=2;i<=n;i++) { del.push_back(t[i]-t[i-1]-1); } sort(del.rbegin(),del.rend()); int sol=t[n]-t[1]+1; for(i=0;i<k-1;i++) { sol-=del[i]; } printf("%i\n",sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 480 KB | Output is correct |
4 | Correct | 2 ms | 592 KB | Output is correct |
5 | Correct | 2 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 592 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 592 KB | Output is correct |
9 | Correct | 2 ms | 596 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 480 KB | Output is correct |
4 | Correct | 2 ms | 592 KB | Output is correct |
5 | Correct | 2 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 592 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 592 KB | Output is correct |
9 | Correct | 2 ms | 596 KB | Output is correct |
10 | Correct | 3 ms | 720 KB | Output is correct |
11 | Correct | 3 ms | 780 KB | Output is correct |
12 | Correct | 3 ms | 800 KB | Output is correct |
13 | Correct | 3 ms | 832 KB | Output is correct |
14 | Correct | 3 ms | 992 KB | Output is correct |
15 | Correct | 3 ms | 992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 480 KB | Output is correct |
4 | Correct | 2 ms | 592 KB | Output is correct |
5 | Correct | 2 ms | 592 KB | Output is correct |
6 | Correct | 2 ms | 592 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 592 KB | Output is correct |
9 | Correct | 2 ms | 596 KB | Output is correct |
10 | Correct | 3 ms | 720 KB | Output is correct |
11 | Correct | 3 ms | 780 KB | Output is correct |
12 | Correct | 3 ms | 800 KB | Output is correct |
13 | Correct | 3 ms | 832 KB | Output is correct |
14 | Correct | 3 ms | 992 KB | Output is correct |
15 | Correct | 3 ms | 992 KB | Output is correct |
16 | Correct | 30 ms | 2864 KB | Output is correct |
17 | Correct | 29 ms | 3884 KB | Output is correct |
18 | Correct | 32 ms | 4868 KB | Output is correct |
19 | Correct | 35 ms | 5812 KB | Output is correct |
20 | Correct | 37 ms | 6756 KB | Output is correct |
21 | Correct | 34 ms | 7760 KB | Output is correct |
22 | Correct | 29 ms | 8824 KB | Output is correct |
23 | Correct | 30 ms | 9692 KB | Output is correct |
24 | Correct | 29 ms | 10652 KB | Output is correct |