답안 #339842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
339842 2020-12-26T09:42:08 Z Thistle 비밀 (JOI14_secret) C++14
0 / 100
574 ms 4844 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rng(i,s,n) for(ll i = (s) ; i < (n) ; i++)
#define rep(i,n) rng(i, 0, (n))
#define vec vector
#define pb emplace_back
#define siz(a) (int)(a).size()

vec<ll>a;
class dsp{
  int n,rr;
  vec<vec<ll>>dat;
  vec<int>lgt;
  public:
  void init(int sz){
    n=sz;
    int cnt=1;//バケットサイズ
    while((1<<cnt)<n) cnt++;
    dat.assign(cnt,vec<ll>(n,0));
    rep(i,n) dat[0][i]=a[i];
    rng(k,1,cnt){
      for(int j=0;j+(1<<k)<n;j+=(1<<(k+1))){
        int t=j+(1<<k);
        dat[k][t-1]=a[t-1],dat[k][t]=a[t];
        for(int r=t-2;r>=j;r--){
          dat[k][r]=Secret(a[r],dat[k][r+1]);
        }
        for(int r=t+1;r<min(n,j+(1<<(k+1)));r++){
          dat[k][r]=Secret(dat[k][r-1],a[r]);
        }
      }
    }
    lgt.assign((1<<cnt),0);
    for(int i=2;i<n+10;i++) lgt[i]=lgt[i>>1]+1;
  }
  int query(int x,int y){
    if(x==y) return dat[0][x];
    int k=lgt[x^y];
    return Secret(dat[k][x],dat[k][y]);
  }
} dsp;
void Init(int N, int A[]) {
  rep(i,N) a.pb(A[i]);
  dsp.init(N);
}

int Query(int L, int R) {
  int k=dsp.query(L,R);
  return k;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 151 ms 4844 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 181 ms 4844 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Incorrect 142 ms 2540 KB Wrong Answer: Query(322, 512) - expected : 354879498, actual : 634763890.
4 Incorrect 522 ms 4544 KB Wrong Answer: Query(281, 737) - expected : 571637895, actual : 593992035.
5 Incorrect 574 ms 4588 KB Wrong Answer: Query(62, 973) - expected : 914512978, actual : 719304324.
6 Incorrect 521 ms 4460 KB Wrong Answer: Query(508, 515) - expected : 679535703, actual : 581355782.
7 Incorrect 510 ms 4460 KB Wrong Answer: Query(62, 969) - expected : 726248456, actual : 198232541.
8 Incorrect 505 ms 4588 KB Wrong Answer: Query(51, 968) - expected : 226602128, actual : 899391755.
9 Incorrect 503 ms 4460 KB Wrong Answer: Query(68, 952) - expected : 432285325, actual : 476914480.
10 Incorrect 506 ms 4588 KB Wrong Answer: Query(49, 970) - expected : 275146573, actual : 688825441.