Submission #1017869

# Submission time Handle Problem Language Result Execution time Memory
1017869 2024-07-09T10:52:40 Z vjudge1 Stove (JOI18_stove) C++17
100 / 100
15 ms 2404 KB
#include <bits/stdc++.h>
//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
using namespace std; //using namespace __gnu_pbds; using namespace chrono;
#define ff first
#define ss second
#define pb push_back
#define gan(x) x.begin(),x.end()
#define rgan(x) x.rbegin(),x.rend()
#define ins insert
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update
typedef long long ll;typedef vector<ll> vecs;typedef vector<vector<ll>> matrix;
const int mod = 1e9+7; const char nl = '\n';
const ll N = 1e5+5;
const ll inf = 1e18;

void ShikiMoril() {
 ll n; cin >> n; ll s; cin >> s ; s-- ;
 vecs vec ( n ), v1;
 forn ( i , n )  cin >> vec [  i ];
 for ( ll i = 0 ; i + 1 < n ; i ++ )  v1 . pb ( vec [ i + 1 ] - vec [ i ] - 1) ;
  sort ( rgan ( v1) ) ;
  ll ans = vec [ n - 1 ] + 1 - vec [ 0 ] ;
  forn ( i ,s )  ans -= v1 [ i ] ;
  cout << ans ;
}
signed main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    ll t = 1;  //cin >> t;
    while (t--) {
        ShikiMoril();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 13 ms 2268 KB Output is correct
17 Correct 13 ms 2400 KB Output is correct
18 Correct 13 ms 2268 KB Output is correct
19 Correct 15 ms 2404 KB Output is correct
20 Correct 13 ms 2268 KB Output is correct
21 Correct 13 ms 2332 KB Output is correct
22 Correct 15 ms 2268 KB Output is correct
23 Correct 13 ms 2268 KB Output is correct
24 Correct 13 ms 2268 KB Output is correct