# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1071978 |
2024-08-23T12:57:06 Z |
hq77 |
Snail (NOI18_snail) |
C++17 |
|
2 ms |
348 KB |
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
int main() {
int h,n;cin>>h>>n;
vector<long long int>v(n);
long long int 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 && Max<h && h>0){
cout<<"-1 -1";
return 0;
}
long long int days_required;
if(h-Max<0){
cout<<0<<" "<<0;
return 0;
}
else if((h-Max)%used>0){
days_required = (h-Max)/used+1;
}
else days_required = (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;}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |