# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
595435 |
2022-07-13T18:18:31 Z |
Belphegor |
Stove (JOI18_stove) |
C++14 |
|
54 ms |
340 KB |
#include<iostream>
using namespace std;
typedef long long ll;
int T[20];
int main(){
int n,k; cin>>n>>k;
for(int i=0; i<n; i++) cin>>T[i];
int ans = 2e9;
for(int i=0; i<(1<<n); i++){
int w = 1;
int on = (i&1);
int c = 1;
for(int j=1; j<n; j++){
if(!on){
++c; ++w;
}
else{
w+=T[j]-T[j-1];
}
on = (i&(1<<j));
}
if(c<=k) ans = min(ans,w);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
54 ms |
292 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
54 ms |
292 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
54 ms |
292 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |