답안 #637120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
637120 2022-08-31T15:28:55 Z Blobo2_Blobo2 비밀 (JOI14_secret) C++17
0 / 100
468 ms 4376 KB
#include "secret.h"

using namespace std;
int seg[4000],n,arr[1000],cnt=0;
void update(int idx=0,int l=0,int r = n-1){
	if(l == r){
		seg[idx] = arr[l];
		return;
	}
	int mid = (l+r)>>1;
	update(idx<<1,mid+1,r);
	update(idx<<1|1,l,mid);
	seg[idx] = Secret(seg[idx<<1], seg[idx<<1|1]);
}
int query(int L,int R,int idx=0,int l=0,int r=n-1){
	if(l >= L && r <= R)return seg[idx];
	if(r < L || l > R)return -1;
	int mid = (l+r)>>1;
	int first = query(L,R,idx<<1,mid+1,r);
	int second = query(L,R,idx<<1|1,l,mid);
	if(first != -1 && second != -1){
		cnt++;
		return Secret(first,second);
	}
	else if(first != -1)
		return first;
	else if(second != -1)
		return second;
	else return -1;
}
void Init(int N,int A[]){
	n = N;
	for(int i=0;i<n;i++)arr[i] = A[i];
	update();
}

int Query(int l,int r){
	return query(l,r);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 108 ms 2344 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34607541.
2 Incorrect 120 ms 2364 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 635080937.
3 Incorrect 136 ms 2288 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 766962142.
4 Incorrect 418 ms 4252 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 339739196.
5 Incorrect 463 ms 4228 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 886608220.
6 Incorrect 414 ms 4184 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 294282791.
7 Incorrect 416 ms 4236 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 585695297.
8 Incorrect 439 ms 4284 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 415589448.
9 Incorrect 417 ms 4376 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 140258477.
10 Incorrect 468 ms 4176 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 5392011.