// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
int main() {
int h,n;cin>>h>>n;
vector<float>v(n);
float used=0, Max=0;
for(int i=0;i<n;i++){
cin>>v[i];
used+=v[i];
if(used>Max)Max=used;
}
if(used<=0 && h>0){
cout<<"-1 -1";
return 0;
}
int days_required = ceil((h-Max)/used);
cout<<days_required<<" ";
int now = days_required*used;
if(now>=h){cout<<0;return 0;}
for(int i=0;i<n;i++){
now+=v[i];
if(now>=h){cout<<i;return 0;}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |