# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243317 | Rainbowbunny | Secret (JOI14_secret) | C++17 | 798 ms | 524292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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[2005];
int Table[1000][1000];
void Create(int l, int r)
{
if(r - l == 1 or r < l)
{
return;
}
int mid = (l + r) >> 1;
for(int i = mid - 1; i >= l; i--)
{
Table[i][mid] = Secret(a[i], Table[i + 1][mid]);
}
for(int i = mid + 2; i <= r; i++)
{
Table[mid + 1][i] = Secret(Table[mid + 1][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 - 1);
}
int Query(int l, int r)
{
if(r == l)
{
return a[r];
}
else if(r - l == 1)
{
return Secret(a[l], a[l + 1]);
}
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]);
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |