Submission #136098

# Submission time Handle Problem Language Result Execution time Memory
136098 2019-07-24T17:41:40 Z PedroBigMan Triple Jump (JOI19_jumps) C++14
19 / 100
2234 ms 211068 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define INF ((ll) pow(2,63) -1)
int insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll N,Q; cin>>N; vector<int> a; In(a,N); cin>>Q;
    int mx[N][N];
    //vector<ll> xx; REP(i,0,N) {xx.pb(-1);} REP(i,0,N) {mx.pb(xx);}
    REP(i,0,N)
    {
        mx[i][i]=a[i];
        REP(j,i+1,N)
        {
            mx[i][j]=max(mx[i][j-1],a[j]);
        }
    }
    int ans[N][N]; //REP(i,0,N) {ans.pb(xx);}
    REP(i,2,N)
    {
        ans[i-2][i]=a[i-2]+a[i-1]+a[i];
        for(ll j=i-3;j>=0;j--)
        {
            ans[j][i]=max(ans[j+1][i],a[i]+a[j]+mx[j+1][(int) floor((ld) (i+j)/2)]);
        }
    }
    int t_ans[N][N]; //REP(i,0,N) {t_ans.pb(xx);}
    REP(i,0,N-2)
    {
        t_ans[i][i+2]=ans[i][i+2];
        REP(j,i+3,N)
        {
            t_ans[i][j]=max(t_ans[i][j-1],ans[i][j]);
        }
    }
    ll l,r;
    REP(i,0,Q)
    {
        cin>>l>>r; cout<<t_ans[l-1][r-1]<<endl;
    }
    return 0;
}

Compilation message

jumps.cpp: In function 'void Out(std::vector<long long int>)':
jumps.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
jumps.cpp:19:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
jumps.cpp:19:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2207 ms 210900 KB Output is correct
12 Correct 2195 ms 210980 KB Output is correct
13 Correct 2233 ms 210944 KB Output is correct
14 Correct 2227 ms 210876 KB Output is correct
15 Correct 2218 ms 211068 KB Output is correct
16 Correct 2204 ms 210392 KB Output is correct
17 Correct 2234 ms 210192 KB Output is correct
18 Correct 2220 ms 210316 KB Output is correct
19 Correct 2223 ms 210848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 32 ms 4080 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 2207 ms 210900 KB Output is correct
12 Correct 2195 ms 210980 KB Output is correct
13 Correct 2233 ms 210944 KB Output is correct
14 Correct 2227 ms 210876 KB Output is correct
15 Correct 2218 ms 211068 KB Output is correct
16 Correct 2204 ms 210392 KB Output is correct
17 Correct 2234 ms 210192 KB Output is correct
18 Correct 2220 ms 210316 KB Output is correct
19 Correct 2223 ms 210848 KB Output is correct
20 Runtime error 32 ms 4080 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -