Submission #209512

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

Compilation message

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