답안 #293251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293251 2020-09-07T19:56:09 Z infinite_iq 비밀 (JOI14_secret) C++14
0 / 100
542 ms 8480 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 ;
int a [1009] , Ans [1009][1009]  ;
void build ( int l , int r , int t ) {
        if ( l == r ) return ;
        if ( ! t ) {
                int crnt = -1 ;
                for ( int i = l ; i <= r ; i ++ ) {
                        crnt = ( crnt == -1 ? a [i] : Secret ( crnt , a [i] ) ) ;
                        Ans [l][i] = crnt ;
                }
        }
        else {
                int crnt = -1 ;
                for ( int i = r ; i >= l ; i -- ) {
                        crnt = ( crnt == -1 ? a [i] : Secret ( a [i] , crnt ) ) ;
                        Ans [r][i] = crnt ;
                }
        }
        build ( l , mid , 1 ) ;
        build ( mid + 1 , r , 0 ) ;
}
void Init ( int N , int A[] ) {
        n = N ;
        for ( int i = 0 ; i < n ; i ++ ) a [i] = A [i] ;
        build ( 0 , n-1 , 0 ) ;
}
int Query ( int L , int R ) {
        int l = 0 , r = n -1 ;
        while ( r != l ) {
                if ( mid == R ) {
                        return Ans [mid][L] ;
                }
                if ( mid + 1 == L ) {
                        return Ans [mid+1][R] ;
                }
                if ( L <= mid && mid < R ) {
                        return Secret ( Ans [mid][L] , Ans [mid+1][R] ) ;
                }
                if ( mid + 1 <= L ) l = mid + 1 ;
                else r = mid ;
        }
        return Ans [l][r] ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 144 ms 4472 KB Output is correct - number of calls to Secret by Init = 4088, maximum number of calls to Secret by Query = 1
2 Correct 145 ms 4600 KB Output is correct - number of calls to Secret by Init = 4097, maximum number of calls to Secret by Query = 1
3 Correct 145 ms 4472 KB Output is correct - number of calls to Secret by Init = 4107, maximum number of calls to Secret by Query = 1
4 Partially correct 508 ms 8480 KB Output isn't correct - number of calls to Secret by Init = 8967, maximum number of calls to Secret by Query = 1
5 Partially correct 521 ms 8312 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
6 Incorrect 502 ms 8312 KB Wrong Answer: Query(998, 999) - expected : 850425289, actual : 538083337.
7 Partially correct 513 ms 8364 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
8 Partially correct 509 ms 8312 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
9 Partially correct 510 ms 8288 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1
10 Partially correct 542 ms 8228 KB Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1