답안 #209513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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]);
                              ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -