Submission #209513

#TimeUsernameProblemLanguageResultExecution timeMemory
209513model_codeSnail (NOI18_snail)C++17
25 / 100
1097 ms376 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...