답안 #479810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
479810 2021-10-13T08:38:18 Z MohammadAghil 비밀 (JOI14_secret) C++14
0 / 100
538 ms 4472 KB
#include <bits/stdc++.h> 
#include "secret.h"
using  namespace std;
typedef  long long ll;
typedef  pair<int, int> pp;
#define  rep(i,l,r) for(int i = (l); i < r; i++)
#define  per(i,r,l) for(int i = (r); i >= l; i--)
#define  all(x) x.begin(), x.end()
#define  sz(x) (int)(x).size()
#define  pb push_back
#define  ff first
#define  ss second 
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
const ll mod = 998244353, maxn = 1e3 + 17, inf = 1e9 + 5;

ll a[maxn], tag[maxn];
ll val[maxn][20];


void slv(int lx, int rx, int t){
    if(lx >= rx) return;
    int mid = (lx + rx) >> 1;
    tag[mid] = t;
    val[mid][t] = a[mid];
    per(i,mid-1,lx){
        val[i][t] = Secret(val[i + 1][t], a[i]);
    }
    val[mid + 1][t] = a[mid + 1];
    rep(i,mid + 2, rx + 1){
        val[i][t] = Secret(val[i - 1][t], a[i]);
    }
    slv(lx, mid, t + 1), slv(mid + 1, rx, t + 1);
}

int Query(int L, int R){
    if(L == R) return a[L];
    ll mi = inf;
    rep(i,L,R + 1) mi = min(mi, tag[i]);
    if(mi == tag[R]) return val[L][mi];
    return Secret(val[L][mi], val[R][mi]);
}

void Init(int N, int A[]) {
	rep(i,0,N) {
        a[i] = A[i];
        tag[i] = inf;
    }
    slv(0, N - 1, 0);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 133 ms 2372 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 135 ms 2484 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 138 ms 2424 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 498 ms 4332 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 523 ms 4376 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 506 ms 4344 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445.
7 Incorrect 506 ms 4472 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 538 ms 4324 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 520 ms 4420 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 509 ms 4416 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.