답안 #922552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
922552 2024-02-05T16:33:40 Z hqminhuwu 비밀 (JOI14_secret) C++14
0 / 100
358 ms 14020 KB
#include "secret.h"
#define forr(_a,_b,_c) for(int _a = (_b); _a <= (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < (_c); ++_a)
#define st first
#define nd second
#define ll long long
 
using namespace std;
const int N = 2e3 + 5;
const ll oo = 1e9;
const ll mod = 1e9 + 7;
 
int n, f[N][N];
 
void calc (int l, int r, int a[]){

	int mid = (l + r) / 2;
	f[mid][mid] = a[mid];
	f[mid + 1][mid + 1] = a[mid + 1];
 
	ford (i, mid - 1, l)
		f[mid][i] = Secret(a[i], f[mid][i + 1]);
 
	forr (i, mid + 2, r)
		f[mid + 1][i] = Secret(a[i], f[mid + 1][i - 1]);
	
	if (l < mid) calc (l, mid, a);
	if (mid + 1 < r) calc (mid + 1, r, a);
}
 
void Init (int u, int a[]){
	n = u;
	calc (0, n - 1, a);
}
 
int Query (int u, int v){
	int l = 0, r = n - 1;
	
	while (l != r){
		int mid = (l + r) / 2;
		if (mid >= u && mid < v) return Secret(f[mid][u], f[mid + 1][v]);
		if (mid == v) return f[mid][u];
		if (mid < u) l = mid + 1;
		else r = mid;
	}
 
	return f[l][l];
}
 
 
/*
 
 
 
*/
 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 98 ms 9560 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 98 ms 9588 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 96 ms 9712 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 350 ms 13668 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 357 ms 13848 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 354 ms 13656 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 354 ms 13876 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 358 ms 13628 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 358 ms 13908 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 358 ms 14020 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.