답안 #390852

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
390852 2021-04-17T08:31:15 Z hhhhaura 비밀 (JOI14_secret) C++14
0 / 100
806 ms 524292 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define INF 1e9
#define MOD 1000000007
#define eps (1e-9)
#define MAXN 2000

#define lld long double
#define pii pair<int ,int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

using namespace std;
#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); }
#else 
#define print(...) 0
#define vprint(...) 0
#endif
int n, b[100][MAXN], a[MAXN];
int Secret(int, int);
void build(int d, int L, int R) {
	if(L == R) b[d][L] = a[L];
	else {
		int mid = (L + R) / 2;
		build(d + 1, L, mid);
		build(d + 1, mid + 1, R);
		b[d][mid] = a[mid];
		b[d][mid + 1] = a[mid + 1];
		rrep(i, L, mid - 1) b[d][i] = Secret(a[i], b[d][i + 1]);			
		rep(i, mid + 2, R) b[d][i] = Secret(b[d][i - 1], a[i]);
	}
}
int query(int d, int L, int R, int l, int r) {
	int mid = (L + R) / 2;
	if(l > R || r < L) return INF;
	else if(l <= mid && r >= mid + 1) 
		return Secret(b[d][l], b[d][r]);
	else return min(
		query(d + 1, L, mid, l, r),
		query(d + 1, mid + 1, R, l, r)
	);	
}
void Init(int N, int A[]) {
	n = N;
	rep(i, 0, n - 1) a[i] = A[i];
	build(1, 0, n - 1);
	return;
}
int Query(int L, int R) {
	return query(1, 0, n - 1, L, R);
}

Compilation message

secret.cpp:3: warning: ignoring #pragma loop  [-Wunknown-pragmas]
    3 | #pragma loop-opt(on)
      |
# 결과 실행 시간 메모리 Grader output
1 Runtime error 436 ms 524292 KB Execution killed with signal 9
2 Runtime error 436 ms 524292 KB Execution killed with signal 9
3 Runtime error 462 ms 524292 KB Execution killed with signal 9
4 Runtime error 779 ms 524292 KB Execution killed with signal 9
5 Runtime error 805 ms 524292 KB Execution killed with signal 9
6 Runtime error 806 ms 524292 KB Execution killed with signal 9
7 Correct 507 ms 4296 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
8 Correct 501 ms 4256 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
9 Correct 509 ms 4372 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1
10 Correct 505 ms 4292 KB Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1