Submission #1062467

# Submission time Handle Problem Language Result Execution time Memory
1062467 2024-08-17T07:31:49 Z jundi Snail (NOI18_snail) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	long long h;
	long long n;
	cin>>h>>n;
	vector<int> a(n);
	long long now=0;
	long long sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}

	if(sum<=0 && h!=0) {
		for(int i=0;i<n;i++){
			now+=a[i];
			if(now>=h) {cout<<0<<" "<<i; return 0;}
		}
		cout<<-1<<" "<<-1<<endl;
	}
	
	long long day=0;
	long long re=0;
	while(day++){
		for(long long i=0;i<n;i++){
			re=i;
			now+=a[i];
			if(now>=h) break;
		}
	}
	cout<<day<<" "<<re;
}
# 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 Incorrect 1 ms 344 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 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -