# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
293049 | 2020-09-07T15:49:26 Z | dolijan | Stove (JOI18_stove) | C++14 | 1 ms | 384 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll n,k; cin>>n>>k; ll a[n]; for(int i=0;i<n;i++) cin>>a[i]; vector<ll> diff; for(int i=1;i<n;i++) diff.push_back(a[i]-a[i-1]); sort(diff.begin(),diff.end()); ll kolko=0; k--; for(int i=diff.size()-1;i>=diff.size()-k;i--) kolko+=diff[i]; kolko=((a[n-1]-a[0])-kolko); kolko+=(k+1); cout<<kolko<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |