| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 196894 | Juney | Stove (JOI18_stove) | C++14 | 26 ms | 2168 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5 + 5;
int N, K;
int A[MAXN], T[MAXN], ans;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> N >> K;
for(int i=1; i<=N; i++) cin >> T[i];
for(int i=1; i<N; i++) A[i] = T[i+1] - T[i]-1;
sort(A+1, A+N, greater<int>());
ans = T[N]+1 - T[1];
for(int i=1; i<K; i++) ans -= A[i];
cout << ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
