답안 #339840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
339840 2020-12-26T09:41:11 Z Thistle 비밀 (JOI14_secret) C++14
0 / 100
518 ms 9068 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<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 150 ms 4716 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 147 ms 4844 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Runtime error 138 ms 4844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 510 ms 8812 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 506 ms 8940 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 510 ms 8684 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 513 ms 9068 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Runtime error 518 ms 8880 KB Execution killed with signal 6 (could be triggered by violating memory limits)
9 Runtime error 508 ms 8684 KB Execution killed with signal 6 (could be triggered by violating memory limits)
10 Runtime error 515 ms 8940 KB Execution killed with signal 6 (could be triggered by violating memory limits)