Submission #209513

# Submission time Handle Problem Language Result Execution time Memory
209513 2020-03-14T12:30:27 Z model_code Snail (NOI18_snail) C++17
25 / 100
1000 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100005;
ll H, N, A[MAXN];
int main() {
	scanf("%lld%lld", &H, &N);
	for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
	ll cur = 0;
	for (ll d = 0; d <= H; ++d) {
		for (int p = 0; p < N; ++p) {
			cur += A[p];
			cur = max(0ll, cur);
			if (cur >= H) {
				printf("%lld %d\n", d, p);
				return 0;
			}
		}
	}
	puts("-1 -1");
}

Compilation message

snail.cpp: In function 'int main()':
snail.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &H, &N);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
snail.cpp:8:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
                              ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Execution timed out 1097 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Execution timed out 1096 ms 376 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Execution timed out 1097 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -