답안 #233612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
233612 2020-05-21T05:28:20 Z triple_fault Stove (JOI18_stove) C++14
100 / 100
30 ms 3192 KB
/* fucking change this 2020 */

#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <random>

#define ll long long

using namespace std;

int main(void) {
    ll n, k; scanf("%lld %lld", &n, &k);
    ll vals[n];
    for (ll i = 0; i < n; ++i) scanf("%lld", &vals[i]);

    vector<ll> dif;
    for (ll i = 1; i < n; ++i) dif.push_back(vals[i] - vals[i - 1] - 1);

    ll ans = n;
    sort(dif.begin(), dif.end());

    for (ll i = 0; i < (n - k); ++i) ans += dif[i];
    printf("%lld\n", ans);
    return 0;
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:17:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     ll n, k; scanf("%lld %lld", &n, &k);
              ~~~~~^~~~~~~~~~~~~~~~~~~~~
stove.cpp:19:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (ll i = 0; i < n; ++i) scanf("%lld", &vals[i]);
                                ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 30 ms 3192 KB Output is correct
17 Correct 28 ms 3192 KB Output is correct
18 Correct 29 ms 3192 KB Output is correct
19 Correct 29 ms 3064 KB Output is correct
20 Correct 28 ms 3192 KB Output is correct
21 Correct 29 ms 3192 KB Output is correct
22 Correct 29 ms 3192 KB Output is correct
23 Correct 29 ms 3192 KB Output is correct
24 Correct 29 ms 3192 KB Output is correct