# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437238 | 2021-06-26T05:57:58 Z | ToroTN | Stove (JOI18_stove) | C++14 | 1 ms | 204 KB |
#include<bits/stdc++.h> using namespace std; int n,m,a[100005],sum; set<int> s; int main() { scanf("%d%d",&n,&m); sum=n; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } for(int i=2;i<=n;i++) { s.insert(a[i]-a[i-1]-1); } for(int i=1;i<=n-m;i++) { sum+=*s.begin(); s.erase(*s.begin()); } printf("%d\n",sum); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |