답안 #376670

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
376670 2021-03-12T00:36:14 Z Leonardo_Paes 비밀 (JOI14_secret) C++17
0 / 100
516 ms 4752 KB
#include "secret.h"
#include <bits/stdc++.h>

typedef std::pair<int,int> pii;
#define f first
#define s second
const int maxn = 1030;
int v[maxn], n;

class Seg{
public:
	void build(int node, int l, int r){
		if(l == r){
			pref[node].push_back(v[l]);
			return;
		}
		int mid = (l + r) >> 1;
		int val;
		for(int i=mid; i>=l; i--){
			if(i == mid) suf[node].push_back(val = v[i]);
			else suf[node].push_back(val = Secret(v[i], val));
		}
		for(int i=mid+1; i<=r; i++){
			if(i == mid+1) pref[node].push_back(val = v[i]);
			else pref[node].push_back(val = Secret(val, v[i]));
		}
		build(2*node, l, mid), build(2*node+1, mid+1, r);
	}
	int query(int node, int tl, int tr, int l, int r){
		int mid = (tl + tr) >> 1;
		if(tl == tr) return pref[node].front();
		if(l <= mid and mid <= r) 
			return Secret(suf[node][mid - l], pref[node][r - mid - 1]);
		else if(l > mid) return query(2*node+1, mid+1, tr, l, r);
		else return query(2*node, tl, mid, l, r);
	}
private:
	std::vector<int> pref[2*maxn], suf[2*maxn];
}seg;

void Init(int N, int A[]) {
	n = N;
	for(int i=1; i<=N; i++) v[i] = A[i-1];
	seg.build(1, 1, n);
}

int Query(int L, int R) {
	L++, R++;
	return seg.query(1, 1, n, L, R);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 155 ms 2540 KB Wrong Answer: Query(264, 271) - expected : 675707686, actual : 4619042.
2 Incorrect 134 ms 2540 KB Wrong Answer: Query(210, 211) - expected : 558550312, actual : 558532904.
3 Incorrect 135 ms 2540 KB Wrong Answer: Query(64, 128) - expected : 469502, actual : 537340286.
4 Incorrect 514 ms 4700 KB Wrong Answer: Query(571, 624) - expected : 309502044, actual : 309493852.
5 Incorrect 507 ms 4580 KB Wrong Answer: Query(876, 890) - expected : 899551822, actual : 362418254.
6 Incorrect 505 ms 4716 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241.
7 Correct 515 ms 4752 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 515 ms 4708 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 513 ms 4588 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 516 ms 4588 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1