답안 #434940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434940 2021-06-22T12:04:32 Z keta_tsimakuridze 비밀 (JOI14_secret) C++14
0 / 100
550 ms 8260 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
int x[1005][1005],a[1005],n;
void solve(int l,int r) {
	if(l==r) return;
	int mid = (l+r)/2; 
	x[mid][mid] = a[mid];
	for(int i=mid-1;i>=l;i--) {
		x[i][mid] = Secret(a[i],x[i+1][mid]);
	}
	
	x[mid+1][mid+1]=a[mid+1];
	for(int i=mid+2;i<=r;i++) {
		x[mid+1][i] = Secret(x[mid+1][i-1],a[i]);
	}
	
	solve(l,mid);
	solve(mid+1,r);
}
void Init(int m, int A[]) {
  Secret(0, 1000000000);
  n = m;
  for(int i = n; i>0; i--) {
  	a[i] = A[i-1];
  }
  solve(1,n);
}

int Query(int L, int R) { //cout<<"++";cout<<"++";
	L++; R++;
	if(L == R) return a[L];
	int  l = 1, r = n;
	
	  while(true) {
		  	int mid = (l+r)/2;
		  	if(R<=mid) {
		  		r = mid - 1;
		  		continue;
			} 
			if(L>mid) {
				l = mid ;
				continue;
			}
		
		//	cout<<L<<" "<<mid<<" "<<x[L][mid]<<" "<<a[R]<<endl;
		  	return Secret(x[L][mid],x[mid+1][R]);
			
			
	  }

}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 139 ms 4292 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 38994019.
2 Incorrect 141 ms 4380 KB Wrong Answer: Query(236, 238) - expected : 173116186, actual : 102957289.
3 Incorrect 142 ms 4368 KB Wrong Answer: Query(334, 369) - expected : 363022362, actual : 536870912.
4 Incorrect 522 ms 8164 KB Wrong Answer: Query(384, 458) - expected : 896057572, actual : 536870912.
5 Incorrect 517 ms 8260 KB Wrong Answer: Query(263, 292) - expected : 653448456, actual : 536870912.
6 Incorrect 521 ms 8132 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 950174288.
7 Correct 531 ms 8196 KB Output is correct - number of calls to Secret by Init = 7979, maximum number of calls to Secret by Query = 1
8 Correct 526 ms 8216 KB Output is correct - number of calls to Secret by Init = 7979, maximum number of calls to Secret by Query = 1
9 Correct 550 ms 8124 KB Output is correct - number of calls to Secret by Init = 7979, maximum number of calls to Secret by Query = 1
10 Correct 541 ms 8248 KB Output is correct - number of calls to Secret by Init = 7979, maximum number of calls to Secret by Query = 1