Submission #293219

# Submission time Handle Problem Language Result Execution time Memory
293219 2020-09-07T19:09:45 Z infinite_iq Secret (JOI14_secret) C++14
0 / 100
507 ms 8440 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 100
#define mp make_pair
#define mid (l+r)/2
#define le node * 2 
#define ri node * 2 + 1 
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
//#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
#define all(x) x.begin(), x.end()
#define gc getchar_unlocked
typedef long long ll;
typedef short int si;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef pair<double,ll>pdi;
const ll inf=2e18;
const ll mod=1e9+7;
const ld Pi=acos(-1) ;
#include "secret.h"
int n , Num = 0 ;
int a [1009] , Ans [1009][1009]  ;
void build ( int l , int r , int t ) {
        if ( ! t ) {
                int crnt = -1 ;
                for ( int i = l ; i <= r ; i ++ ) {
                        if ( crnt != -1 ) Num ++ ;
                        crnt = ( crnt == -1 ? a [i] : Secret ( crnt , a [i] ) ) ;
                        Ans [l][i] = crnt ;
                }
        }
        else {
                int crnt = -1 ;
                for ( int i = r ; i >= l ; i -- ) {
                        if ( crnt != -1 ) Num ++ ;
                        crnt = ( crnt == -1 ? a [i] : Secret ( crnt , a [i] ) ) ;
                        Ans [i][r] = crnt ;
                }
        }
        if ( l == r ) return ;
        build ( l , mid , 1 ) ;
        build ( mid + 1 , r , 0 ) ;
}
void Init ( int N , int A[] ) {
        mem ( Ans , -1 ) ;
        n = N ;
        for ( int i = 0 ; i < n ; i ++ ) a [i] = A [i] ;
        build ( 0 , n-1 , 0 ) ;
}
int Query ( int L , int R ) {
        if ( Ans [L][R] != -1 ) return Ans [L][R] ;
        Num = 0 ;
        for ( int i = L ; i < R ; i ++ ) {
                if ( Ans [L][i] != -1 && Ans [i+1][R] != -1 ) {
                        Ans [L][R] = Secret ( Ans [L][i] , Ans [i+1][R] ) ;
                        Num ++ ;
                        break ;
                }
        }
        return Ans [L][R] ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 6392 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 137 ms 6396 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 136 ms 6392 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 497 ms 8440 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 499 ms 8312 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 498 ms 8312 KB Wrong Answer: Query(653, 654) - expected : 227441904, actual : 93182529.
7 Incorrect 502 ms 8440 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 501 ms 8316 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 507 ms 8436 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 505 ms 8312 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.