답안 #930307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930307 2024-02-19T10:36:42 Z noyancanturk 비밀 (JOI14_secret) C++17
0 / 100
361 ms 4572 KB
#include "secret.h"
#include <cassert>
const int lim=1100;

int n,*a;
int aa[15][lim];

void dnc(int l,int r,int dep=0){
	if(l==r){
		return;
	}
	int mid=(l+r)>>1;
	aa[dep][mid]=a[mid];
	for(int i=mid-1;l<=i;i--){
		aa[dep][i]=Secret(a[i],aa[dep][i+1]);
	}
	aa[dep][mid+1]=a[mid+1];
	for(int i=mid+2;i<=r;i++){
		aa[dep][i]=Secret(aa[dep][i-1],a[i]);
	}
	dnc(l,mid,dep+1),dnc(mid+1,r,dep+1);
}

void Init(int N, int A[]) {
	n=N;
	a=A;
	dnc(0,n-1);
}

int Query(int L, int R) {
	if(L==R){
		return a[L];
	}
	int l=0,r=n-1,dep=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(L<=mid&&mid<R){
			return Secret(aa[dep][L],aa[dep][R]);
		}else if(mid+1==L){
			return aa[dep][R];
		}
		else if(mid==R){
			return aa[dep][L];
		}else if(mid<L){
			l=mid+1;
		}else{
			r=mid-1;
		}
		dep++;
	}
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 3668 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 103 ms 3668 KB Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1
3 Incorrect 94 ms 3668 KB Wrong Answer: Query(128, 153) - expected : 959658850, actual : 764916540.
4 Incorrect 352 ms 4196 KB Wrong Answer: Query(172, 187) - expected : 590352579, actual : 668684337.
5 Incorrect 348 ms 4188 KB Wrong Answer: Query(584, 592) - expected : 111053842, actual : 514219292.
6 Incorrect 356 ms 4572 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 188307410.
7 Correct 355 ms 4432 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 361 ms 4428 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 358 ms 4432 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 359 ms 4372 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1