# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
992554 | voi | Stove (JOI18_stove) | C++17 | 18 ms | 2004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int ar = 2e5+2;
const ll mod = 1e9+7;
const int oo = 1e9;
int n, k, a[2];
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
#define task "stove"
if(fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
cin >> n >> k;
int bit = 0;
vector <int> v;
for(int i = 1; i <= n; ++i) {
cin >> a[bit];
if(i > 1)
v.push_back(a[bit] - a[bit ^ 1] - 1);
bit ^= 1;
}
sort(v.begin(), v.end());
int res = n;
for(int i = 0; i < n - k; ++i)
res += v[i];
cout << res;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |