제출 #242334

#제출 시각아이디문제언어결과실행 시간메모리
242334SomeoneUnknownTriple Jump (JOI19_jumps)C++14
5 / 100
4059 ms13208 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; scanf("%d", &n); int firm[n]; for(int i = 0; i < n; ++i){ scanf("%d", &firm[i]); } int best[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ best[i][j] = 0; if(j <= i+1){ continue; } int base = firm[i]+firm[j]; for(int k = i+1; k <= (i+j)/2; k++){ best[i][j] = max(best[i][j], base + firm[k]); } } } int q; scanf("%d", &q); for(int i = 0; i < q; i++){ int a, c; scanf("%d %d", &a, &c); int cbest = 0; for(int j = a; j < c; j++){ for(int k = j+2; k <= c; k++){ cbest = max(cbest, best[j-1][k-1]); } } printf("%d\n", cbest); } }

컴파일 시 표준 에러 (stderr) 메시지

jumps.cpp: In function 'int main()':
jumps.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
jumps.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &firm[i]);
         ~~~~~^~~~~~~~~~~~~~~~
jumps.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &q);
     ~~~~~^~~~~~~~~~
jumps.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a, &c);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...