답안 #339833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
339833 2020-12-26T09:34:03 Z Thistle 비밀 (JOI14_secret) C++14
0 / 100
512 ms 8996 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 rr=2,cnt=1;//バケットサイズ
    while(rr<n) rr*=2,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<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(a[r],dat[k][r-1]);
        }
      }
    }
    lgt.assign(n+10,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 136 ms 4844 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Incorrect 135 ms 2668 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Runtime error 141 ms 4972 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 507 ms 8812 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 502 ms 8812 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 507 ms 8996 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 510 ms 8940 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Runtime error 512 ms 8940 KB Execution killed with signal 6 (could be triggered by violating memory limits)
9 Runtime error 505 ms 8812 KB Execution killed with signal 6 (could be triggered by violating memory limits)
10 Runtime error 510 ms 8812 KB Execution killed with signal 6 (could be triggered by violating memory limits)