Submission #812154

# Submission time Handle Problem Language Result Execution time Memory
812154 2023-08-07T07:31:50 Z vjudge1 Triple Jump (JOI19_jumps) C++14
19 / 100
4000 ms 143948 KB
#include<bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define fi first
#define se second
#define ll long long
using namespace std ;
const int N = 5e5, NS = 5e3 ;
int n, q, d[N + 1], dp[NS + 1][NS + 1], mx[NS + 1][NS + 1] ;
signed main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i++)
        cin >> d[i] ;
    cin >> q ;
//    if(n <= 5000)
//    {
        for(int i = 1 ; i <= n ; i++)
            for(int j = i ; j <= n ; j++)
                mx[i][j] = max(mx[i][j - 1], d[j]) ;
        for(int i = 1 ; i <= n - 2 ; i++)
            dp[i][i + 2] = d[i] + d[i + 1] + d[i + 2] ;
        for(int ln = 4 ; ln <= n ; ln++)
            for(int j = 1 ; j <= n - ln + 1 ; j++)
                dp[j][j + ln - 1] = max({dp[j][j + ln - 2], dp[j + 1][j + ln - 1], d[j] + d[j + ln - 1] + mx[j + 1][j + (ln - 1) / 2]}) ;
        while(q--)
        {
            int l, r ;
            cin >> l >> r ;
            cout << dp[l][r] << '\n' ;
        }
        return 0 ;
//    }
    return 0 ;
}

Compilation message

jumps.cpp:2: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    2 | #pragma comment(linker, "/stack:200000000")
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1108 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 1 ms 1108 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 1 ms 1092 KB Output is correct
9 Correct 1 ms 1108 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1108 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 1 ms 1108 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 1 ms 1092 KB Output is correct
9 Correct 1 ms 1108 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 558 ms 143936 KB Output is correct
12 Correct 491 ms 143920 KB Output is correct
13 Correct 497 ms 143896 KB Output is correct
14 Correct 473 ms 143948 KB Output is correct
15 Correct 472 ms 143860 KB Output is correct
16 Correct 480 ms 143228 KB Output is correct
17 Correct 649 ms 143184 KB Output is correct
18 Correct 496 ms 143208 KB Output is correct
19 Correct 513 ms 143744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4041 ms 94400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1108 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 1 ms 1108 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 1 ms 1092 KB Output is correct
9 Correct 1 ms 1108 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 558 ms 143936 KB Output is correct
12 Correct 491 ms 143920 KB Output is correct
13 Correct 497 ms 143896 KB Output is correct
14 Correct 473 ms 143948 KB Output is correct
15 Correct 472 ms 143860 KB Output is correct
16 Correct 480 ms 143228 KB Output is correct
17 Correct 649 ms 143184 KB Output is correct
18 Correct 496 ms 143208 KB Output is correct
19 Correct 513 ms 143744 KB Output is correct
20 Execution timed out 4041 ms 94400 KB Time limit exceeded
21 Halted 0 ms 0 KB -