| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 338617 | Berted | 비밀 (JOI14_secret) | C++14 | 544 ms | 8428 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "secret.h"
#include <vector>
using namespace std;
int N, res[1001][1001], cnt = 0;
vector<int> A;
void build(int L, int R)
{
if (L < R)
{
int M = L + R >> 1;
build(L, M);
build(M + 1, R);
res[M][M] = A[M]; res[M + 1][M + 1] = A[M + 1];
for (int i = M - 1; i >= L; i--) {cnt++; res[i][M] = Secret(A[i], res[i + 1][M]);}
for (int i = M + 2; i <= R; i++) {cnt++; res[M + 1][i] = Secret(res[M + 1][i - 1], A[i]);}
//cerr << "B: " << L << " " << R << " " << cnt << "\n";
}
}
int qry(int L, int R, int l, int r)
{
if (l == r) {return A[l];}
else if (L < R)
{
int M = L + R >> 1;
if (r <= M) {return qry(L, M, l, r);}
else if (l > M) {return qry(M + 1, R, l, r);}
else
{
//cerr << "Q:" << L << " " << l << " " << R << " " << r << " " << M << " " << res[l][M] << " " << res[M + 1][r] << "\n";
return Secret(res[l][M], res[M + 1][r]);
}
}
}
void Init(int N, int A[])
{
::N = N;
for (int i = 0; i < N; i++) {::A.push_back(A[i]);}
build(0, N - 1);
}
int Query(int L, int R)
{
return qry(0, N - 1, L, R);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
