답안 #682123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
682123 2023-01-15T20:50:39 Z NK_ 비밀 (JOI14_secret) C++17
6 / 100
459 ms 4492 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;

#define nl '\n'


const int nax = 1005;
const int kax = 32 - __builtin_clz(nax);
int stor[nax][kax];
int N, M;
vector<int> A;

void fill(int l, int r, int ind) {
	if (ind < 0) return;
	int m = (l+r)/2, cur;

	// cout << l << " " << m << " " << r << " (" << ind << ")" << endl;

	stor[m-1][ind] = cur = A[m-1]; 
	for(int i = m-2; i >= l; i--) stor[i][ind] = cur = Secret(A[i], cur);

	stor[m][ind] = cur = A[m];
	for(int i = m+1; i < min(N, r); i++) stor[i][ind] = cur = Secret(cur, A[i]);

	fill(l, m, ind-1); fill(m, r, ind-1);
}


void Init(int _N, int _A[]) {
	N = _N;
	M = 1; while((1<<M) < N) ++M;

	A = vector<int>(N);
	for(int i = 0; i < N; i++) A[i] = _A[i];

	fill(0, (1<<M), M-1);
	// cerr << "DONE" << endl;
}

int Query(int L, int R) {
	if (L == R) return A[L];
	int t = 31 - __builtin_clz(L ^ R);
	return Secret(stor[L][t], stor[R][t]);
};
# 결과 실행 시간 메모리 Grader output
1 Correct 118 ms 2360 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Correct 120 ms 2376 KB Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1
3 Correct 118 ms 2416 KB Output is correct - number of calls to Secret by Init = 5890, maximum number of calls to Secret by Query = 1
4 Partially correct 459 ms 4312 KB Output isn't correct - number of calls to Secret by Init = 8023, maximum number of calls to Secret by Query = 1
5 Partially correct 413 ms 4404 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1
6 Partially correct 415 ms 4348 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1
7 Partially correct 415 ms 4404 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1
8 Partially correct 416 ms 4492 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1
9 Partially correct 426 ms 4332 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1
10 Partially correct 418 ms 4312 KB Output isn't correct - number of calls to Secret by Init = 8030, maximum number of calls to Secret by Query = 1