답안 #243314

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243314 2020-06-30T22:27:16 Z Rainbowbunny 비밀 (JOI14_secret) C++17
0 / 100
507 ms 8312 KB
#include <bits/stdc++.h>
#include "secret.h"
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
 
const int Inf = 2e9;
const int mod = 998244353;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
 
int n;
int a[1005];
int Table[1005][1005];
 
void Create(int l, int r)
{
	if(r - l == 1)
	{
		return;
	}	
	int mid = (l + r) >> 1;
	for(int i = mid - 1; i >= l; i--)
	{
		Table[i][mid] = Secret(Table[i + 1][mid], a[i]);
	}
	for(int i = mid + 2; i <= r; i++)
	{
		Table[mid][i] = Secret(Table[mid][i - 1], a[i]);
	}
	Create(l, mid);
	Create(mid + 1, r);
}
 
void Init(int N, int b[])
{
	n = N;
	for(int i = 0; i < n; i++)
	{
		a[i] = b[i];
		for(int j = 0; j < n; j++)
		{
			Table[i][j] = Inf;
		}
		Table[i][i] = a[i];
	}
	Create(0, n);
}
 
 
 
int Query(int l, int r)
{
	if(Table[l][r] != Inf)
	{
		return Table[l][r];
	}
	else
	{
		if(Table[l][r] != Inf)
		{
			return Table[l][r];
		}
		for(int i = l; i < r; i++)
		{
			if(Table[l][i] != Inf and Table[i + 1][r] != Inf)
			{
				return Secret(Table[l][i], Table[i + 1][r]);
			}
		}
	}
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:83:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 4472 KB Wrong Answer [1]
2 Incorrect 136 ms 4472 KB Wrong Answer [1]
3 Incorrect 137 ms 4472 KB Wrong Answer [1]
4 Incorrect 495 ms 8312 KB Wrong Answer [1]
5 Incorrect 493 ms 8312 KB Wrong Answer [1]
6 Incorrect 507 ms 8304 KB Wrong Answer [1]
7 Incorrect 498 ms 8184 KB Wrong Answer [1]
8 Incorrect 493 ms 8184 KB Wrong Answer [1]
9 Incorrect 496 ms 8312 KB Wrong Answer [1]
10 Incorrect 504 ms 8312 KB Wrong Answer [1]