답안 #881483

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881483 2023-12-01T09:43:17 Z smartmonky 비밀 (JOI14_secret) C++14
0 / 100
673 ms 524288 KB
#include "secret.h"
#include <bits/stdc++.h>
 
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
 
using namespace std;
 
int b[1005];
int t[1005][1005];

int cnt = 0;
int N;

void build(int l = 0, int r = N - 1){
	if(l > r)return;
	if(l == r){
		t[l][r] = b[l];
		return;
	}
	int mid = (l + r) >> 1;
	
	t[mid][mid] = b[mid];
	
	for(int i = mid - 1; i >= l; i--){
		t[i][mid] = Secret(b[i], t[i + 1][mid]); 
	}
	
	for(int i = mid + 1; i <= r; i++){
		t[mid][i] = Secret(b[i], t[i - 1][mid]); 
	}
	build(l, mid - 1);
	build(mid + 1, r);
}

int get(int al, int ar, int l = 0, int r = N - 1){
	if(al > r || ar < l)return 0;
	int mid = (l + r) >> 1;
	if(l == r)
		return b[l];
	if(l >= al && ar <= r)
		return Secret(t[l][mid], t[mid + 1][r]);
	else{
		return get(al, ar, l, mid - 1) + get(al, ar, mid + 1, r);
	}
}
int Query(int l, int r){
	
	return get(l, r);
}
 
void Init(int n, int a[])
{
	N = n;
	for(int i=0;i<n;i++)b[i]=a[i];
	build();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 102 ms 6740 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 1018587788.
2 Incorrect 102 ms 6828 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 329741984.
3 Runtime error 454 ms 524288 KB Execution killed with signal 9
4 Runtime error 673 ms 524288 KB Execution killed with signal 9
5 Runtime error 668 ms 524288 KB Execution killed with signal 9
6 Incorrect 372 ms 8372 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0.
7 Runtime error 666 ms 524288 KB Execution killed with signal 9
8 Runtime error 649 ms 524288 KB Execution killed with signal 9
9 Runtime error 659 ms 524288 KB Execution killed with signal 9
10 Runtime error 671 ms 524288 KB Execution killed with signal 9