답안 #111479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111479 2019-05-15T12:53:40 Z vex 비밀 (JOI14_secret) C++14
0 / 100
572 ms 8792 KB
#include <bits/stdc++.h>
#include <secret.h>
#define maxn 1005
using namespace std;
 
int rez[12][maxn];
int to[maxn];
int tpp[maxn];
int nn;
 
void Init(int n,int a[])
{
  	nn=n;
	for(int i=1;i<=n;i*=2)
	{
		int pos=n-i;
		rez[i][0]=a[i];
		for(int j=1;pos+j<n;j++)
		{
			rez[i][j]=Secret(rez[i][j-1],a[pos+j]);
		}
		
		to[pos-1]=a[pos-1];
		tpp[pos-1]=i;
		for(int j=pos-2;j>max(pos-2*i,-1);j--)
		{
			to[j]=Secret(a[j],to[j+1]);
			tpp[j]=i;
		}
	}
}
 
int Query(int l,int r)
{
	if(__builtin_popcount(nn-l)==1)
	{
		int x=log2(r-l+1);
		if((1<<x)!=r-l+1)x++;
		
		return rez[x][r-x];
	}
	else
	{
		return Secret(to[l],rez[tpp[l]][r-(nn-(1<<tpp[l]))]);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 142 ms 4728 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 143 ms 4860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 137 ms 4856 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 514 ms 8696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 551 ms 8652 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 572 ms 8676 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 529 ms 8640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 518 ms 8628 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 524 ms 8584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 543 ms 8792 KB Execution killed with signal 11 (could be triggered by violating memory limits)