제출 #1007963

#제출 시각아이디문제언어결과실행 시간메모리
1007963Rolo6783단 점프 (JOI19_jumps)C++14
5 / 100
4067 ms14544 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long>a(n+1); for(int i = 1;i<=n;i++) { cin >> a[i]; } vector<vector<pair<long long,long long>>>p(n+1); for(int i = 1;i<=n;i++) { long long mx = 0; for(int j = i+1;j<=n;j++) { if(a[j] >= mx ) { p[i].push_back({a[j],j}); } mx = max(a[j],mx); } } int q; cin >> q; while(q--) { int l,r; cin >> l >> r; long long ans = 0; int a1,b,c; for(int i = l;i<=r-2;i++) { for(auto j :p[i]) { if(j.second > r-1) { continue; } for(int k = 2*(j.second) - i;k <= r;k++) { if(k<1 || !(k -j.second >= j.second - i )|| k <=j.second || k<=i) { continue; } ans = max(ans,a[i]+j.first+a[k]); } } } cout << ans <<'\n'; } }

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

jumps.cpp: In function 'int main()':
jumps.cpp:35:13: warning: unused variable 'a1' [-Wunused-variable]
   35 |         int a1,b,c;
      |             ^~
jumps.cpp:35:16: warning: unused variable 'b' [-Wunused-variable]
   35 |         int a1,b,c;
      |                ^
jumps.cpp:35:18: warning: unused variable 'c' [-Wunused-variable]
   35 |         int a1,b,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...