Submission #242303

#TimeUsernameProblemLanguageResultExecution timeMemory
242303shenxyTriple Jump (JOI19_jumps)C++11
5 / 100
4057 ms2808 KiB
#include <cstdio> #include <algorithm> using namespace std; int main() { int N, Q, L, R; scanf("%d", &N); int A[N]; for (int i = 0; i < N; ++i) scanf("%d", &A[i]); scanf("%d", &Q); for (int i = 0; i < Q; ++i) { scanf("%d %d", &L, &R); --L, --R; int ans = 0; for (int i = L; i <= R; ++i) { for (int j = i + 1; j <= R; ++j) { for (int k = j + j - i; k <= R; ++k) ans = max(ans, A[i] + A[j] + A[k]); } } printf("%d\n", ans); } return 0; }

Compilation message (stderr)

jumps.cpp: In function 'int main()':
jumps.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
jumps.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("%d", &A[i]);
                              ~~~~~^~~~~~~~~~~~~
jumps.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &Q);
  ~~~~~^~~~~~~~~~
jumps.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &L, &R);
   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...