Submission #1071950

# Submission time Handle Problem Language Result Execution time Memory
1071950 2024-08-23T12:42:58 Z hq77 Snail (NOI18_snail) C++17
0 / 100
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<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;}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 0 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 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -