# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
632422 |
2022-08-20T03:26:19 Z |
iomoon191 |
Stove (JOI18_stove) |
C++17 |
|
28 ms |
1864 KB |
#include<bits/stdc++.h>
// #define int long long
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define eb emplace_back
#define For(i,a,b) for(int i=(a); i<=(b); ++i)
#define roF(i,a,b) for(int i=(a); i>=(b); --i)
#define fi first
#define se second
#define mod 998244353
using namespace std;
// using namespace atcoder;
#ifdef DEBUG__
struct db_os{
ostream& os;
bool chk;
template<class T> auto operator<<(T&& x){
if(!chk) os << ", ";
chk=0;
os << x;
return *this;
}
};
template<class... T> void db_out(T&&... t){
(db_os{cerr, 1} << ... << t);
}
#define dbg(...) \
do{ \
cerr << __LINE__ << ":" << #__VA_ARGS__ << "="; \
db_out(__VA_ARGS__); \
cerr << "\n"; \
}while(0);
#else
#define dbg(...)
#endif
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef long double ld;
const int N=5005;
const ll inf=0x3f3f3f3f;
mt19937 rng(random_device {}());
int rand(int a){
return rng()%a;
}
int n, k;
vi vc;
void rmain(){
int f;
cin >> n >> k >> f;
For(i,2,n){
int x; cin >> x;
vc.pb(x-f-1);
f=x;
}
sort(all(vc));
int res=n;
For(i,0,n-k-1) res+=vc[i];
cout << res;
}
signed main(int argc, char *argv[]){
iostream::sync_with_stdio(0);
int T=1;
while(T--) rmain();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
0 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
320 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
0 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
320 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
0 ms |
320 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
320 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
20 ms |
1864 KB |
Output is correct |
17 |
Correct |
16 ms |
1760 KB |
Output is correct |
18 |
Correct |
17 ms |
1864 KB |
Output is correct |
19 |
Correct |
17 ms |
1760 KB |
Output is correct |
20 |
Correct |
18 ms |
1800 KB |
Output is correct |
21 |
Correct |
28 ms |
1804 KB |
Output is correct |
22 |
Correct |
17 ms |
1752 KB |
Output is correct |
23 |
Correct |
17 ms |
1864 KB |
Output is correct |
24 |
Correct |
17 ms |
1756 KB |
Output is correct |