답안 #553434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
553434 2022-04-25T20:02:19 Z Hanksburger 비밀 (JOI14_secret) C++17
0 / 100
455 ms 8360 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int sum[1005][1005], val[1005], num;
void recur(int l, int r)
{
	if (l==r)
	{
		sum[l][l]=val[l];
		return;
	}
	int mid=(l+r)/2;
	sum[mid][mid]=val[mid];
	sum[mid+1][mid+1]=val[mid+1];
	for (int i=mid-1; i>=l; i--)
		sum[mid][i]=Secret(sum[mid][i+1], val[i]);
	for (int i=mid+2; i<=r; i++)
		sum[mid+1][i]=Secret(sum[mid+1][i-1], val[i]);
	recur(l, mid);
	recur(mid+1, r);
}
void Init(int n, int a[])
{
	num=n;
	for (int i=0; i<n; i++)
		val[i]=a[i];
	recur(0, n-1);
}
int Query(int l, int r)
{
	int a=0, b=num-1;
	while (a<b)
	{
		int mid=(a+b)/2;
		if (l<=mid && mid<r)
			return Secret(sum[mid][l], sum[mid+1][r]);
		else if (r<=mid)
			b=mid;
		else
			a=mid+1;
	}
	return sum[a][a];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 115 ms 4452 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 118 ms 4440 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 118 ms 4420 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 434 ms 8252 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 428 ms 8356 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 441 ms 8340 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445.
7 Incorrect 437 ms 8284 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 435 ms 8348 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 439 ms 8360 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 455 ms 8224 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.