| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 31884 | aome | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 483 ms | 89904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int M = 10000005;
const int INF = 1e9;
int n, q;
int nxt[M], res[M];
bool in[M];
int main() {
scanf("%d %d", &n, &q);
for (int i = 0; i < n; ++i) {
int x; scanf("%d", &x), in[x] = 1;
}
for (int i = 2; i < M; ++i) {
if (nxt[i] || !in[i]) continue;
for (int j = 0; j < M; j += i) nxt[j] = max(nxt[j], i);
}
int cur = 0;
for (int i = 1; i < M; ++i) {
while (cur < i) {
if (!nxt[cur] || cur + nxt[cur] <= i) cur++;
else break;
}
if (cur == i) break;
res[i] = res[cur] + 1;
}
while (q--) {
int x; scanf("%d", &x);
if (!res[x]) printf("oo\n");
else printf("%d\n", res[x]);
}
}
컴파일 시 표준 에러 (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... | ||||
