답안 #536209

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536209 2022-03-12T15:15:40 Z michao 비밀 (JOI14_secret) C++14
0 / 100
20000 ms 12168 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=1e3+5;
int pref[MAX][MAX];
int suf[MAX][MAX];
int n;
int a[MAX];
void rec1(int l,int r){
	if (l>r)return;
	int mid=(l+r)>>1;
	pref[mid][mid]=a[mid];
	suf[mid][mid+1]=a[mid+1];
	for (int i=mid-1;i>=l;i--){
		pref[mid][i]=Secret(a[i],pref[mid][i+1]);
	}
	
	for (int i=mid+1;i<=r;i++){
		suf[mid][i]=Secret(suf[mid][i-1],a[i]);
	}	
	if (l<r){
		rec1(l,mid);
		rec1(mid+1,r);
	}
}

void Init(int N,int A[]){
	n=N;
	for (int i=0;i<n;i++)a[i]=A[i];
	rec1(0,n-1);
}

int rec2(int l,int r,int L,int R){
	int mid=(l+r)>>1;
	if (L>mid)return rec2(mid+1,r,L,R);
	if (R<=mid)return rec2(l,mid,L,R);
	return Secret(pref[mid][l],suf[mid][r]);
}	

int Query(int L,int R){
	return rec2(0,n-1,L,R);
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 6348 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 324292586.
2 Incorrect 120 ms 6300 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 401641632.
3 Incorrect 133 ms 6340 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 76556308.
4 Incorrect 459 ms 12108 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 635076608.
5 Incorrect 490 ms 12084 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536920148.
6 Execution timed out 20076 ms 12124 KB Time limit exceeded
7 Incorrect 439 ms 12112 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 690201657.
8 Incorrect 514 ms 12108 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 812884248.
9 Incorrect 463 ms 12052 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 299244610.
10 Incorrect 463 ms 12168 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 875372551.