| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 93860 | alexpetrescu | 게임 (IOI13_game) | C++14 | 13097 ms | 149928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <cstring>
#include <algorithm>
long long ***rmq;
int nrlin, nrcol, lg2[100001];
long long gcd2(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
void init(int R, int C) {
nrlin = R;
nrcol = C;
int n = std::max(nrlin, nrcol);
for (int i = 2; i <= n; i++)
if ((1 << (lg2[i - 1] + 1)) == i)
lg2[i] = lg2[i - 1] + 1;
else
lg2[i] = lg2[i - 1];
rmq = new long long**[nrlin];
for (int i = 0; i < nrlin; i++) {
rmq[i] = new long long*[nrcol];
for (int j = 0; j < nrcol; j++) {
rmq[i][j] = new long long[lg2[nrcol] + 1];
for (int b = 0; b <= lg2[nrcol]; b++)
rmq[i][j][b] = 0;
}
}
}
void update(int P, int Q, long long K) {
rmq[P][Q][0] = K;
for (int i = P; i < nrlin; i++)
for (int j = Q; j < nrcol; j++)
for (int b = 1; (1 << b) <= j + 1; b++)
rmq[i][j][b] = gcd2(rmq[i][j][b - 1], rmq[i][j - (1 << (b - 1))][b - 1]);
}
long long calculate(int P, int Q, int U, int V) {
int b = lg2[V - Q + 1];
long long ans = 0;
for (int i = P; i <= U; i++)
ans = gcd2(ans, gcd2(rmq[i][V][b], rmq[i][Q + (1 << b) - 1][b]));
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
