# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1007966 | 2024-06-26T03:37:52 Z | Rolo678 | 3단 점프 (JOI19_jumps) | C++14 | 4000 ms | 15516 KB |
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int>a(n+1); for(int i = 1;i<=n;i++) { cin >> a[i]; } vector<vector<pair<int,int>>>p(n+1); for(int i = 1;i<=n;i++) { int 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,(long long)(a[i]+j.first+a[k])); } } } cout << ans <<'\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Execution timed out | 4072 ms | 1060 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4027 ms | 15516 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Execution timed out | 4072 ms | 1060 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |