답안 #70194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70194 2018-08-22T13:12:26 Z MladenP 비밀 (JOI14_secret) C++17
0 / 100
20000 ms 6536 KB
#include <bits/stdc++.h>
#include "secret.h"
#define STIZE(x) fprintf(stderr, "STIZE%lld\n", x);
#define PRINT(x) fprintf(stderr, "%s = %lld\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
#define MAXN 1010
int n, a[MAXN], d[MAXN][MAXN];
void init(int l, int r) {
	if(r < l) return;
	d[mid][mid] = a[mid];
	for(int i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
	d[mid-1][mid] = a[mid-1];
	for(int i = mid-2; i >= l; i--) d[i][mid] = Secret(a[i], d[i+1][mid]);
	init(l, mid); init(mid+1, r);
}
void Init(int N, int A[]) {
	n = N;
	for(int i = 0; i < n; i++) a[i] = A[i];
	init(0, N-1);
}
int query(int l, int r, int L, int R) {
	if(L < mid && mid <= R) return Secret(d[L][mid],d[mid][R]);
	if(mid < L) return query(mid+1, r, L, R);
	if(R <= mid) return query(l, mid, L, R);

}
int Query(int L, int R) {
	if(L == R) return a[L];
	if(L+1 == R) return Secret(a[L], a[R]);
	return query(0, n-1, L, R);
}

Compilation message

secret.cpp: In function 'int query(int, int, int, int)':
secret.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20087 ms 3448 KB Time limit exceeded
2 Execution timed out 20003 ms 3448 KB Time limit exceeded
3 Execution timed out 20044 ms 3544 KB Time limit exceeded
4 Execution timed out 20056 ms 6528 KB Time limit exceeded
5 Execution timed out 20034 ms 6528 KB Time limit exceeded
6 Execution timed out 20010 ms 6528 KB Time limit exceeded
7 Execution timed out 20085 ms 6528 KB Time limit exceeded
8 Execution timed out 20084 ms 6528 KB Time limit exceeded
9 Execution timed out 20027 ms 6536 KB Time limit exceeded
10 Execution timed out 20029 ms 6536 KB Time limit exceeded