# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41598 | 2018-02-19T19:05:17 Z | Abelyan | Stove (JOI18_stove) | C++14 | 3 ms | 620 KB |
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define mpr make_pair #define pr pair<int,long long> #define st string #define vint vector<int> #define vpr vector<pr> #define fr first #define sc second #define add push_back #define del pop_back #define qdel pop inline int scn() { int hg; scanf("%d",&hg); return hg; }; const int N=5006; int a[N],b[N]; int main(){ ios_base::sync_with_stdio(false); int n=scn(); int k=scn(); for (int i=0;i<n;i++){ a[i]=scn(); if (i>0){ b[i-1]=a[i]-a[i-1]-1; } } sort(b,b+n-1); int ans=n; for (int i=0;i<n-k;i++){ ans+=b[i]; } cout<<ans<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Correct | 1 ms | 532 KB | Output is correct |
6 | Correct | 1 ms | 548 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Correct | 1 ms | 532 KB | Output is correct |
6 | Correct | 1 ms | 548 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 2 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 460 KB | Output is correct |
5 | Correct | 1 ms | 532 KB | Output is correct |
6 | Correct | 1 ms | 548 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 620 KB | Output is correct |
13 | Correct | 2 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 2 ms | 620 KB | Output is correct |
16 | Execution timed out | 3 ms | 620 KB | Time limit exceeded (wall clock) |
17 | Halted | 0 ms | 0 KB | - |