| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 31861 | minhtung0404 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 653 ms | 80532 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
const int N = 1e5 + 5;
const int M = 1e7 + 5;
const int inf = 1e9;
using namespace std;
int n, q, p[N], m, prime[M], ans[M], cnt = 1, ct;
int main(){
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
for (int i = 1; i <= n; i++){
for (int j = 0; j < M; j+=p[i]) prime[j] = max(prime[j], p[i]);
}
for (int i = 1; i < M; i++) ans[i] = -inf;
while(ct < M){
if (ans[ct] < 0) break;
while(cnt < ct + prime[ct] && cnt < M) ans[cnt] = ans[ct] + 1, cnt++;
ct++;
}
while(q--){
cin >> m;
if (ans[m] <= 0) printf("oo\n");
else printf("%d\n", ans[m]);
}
}
컴파일 시 표준 에러 (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... | ||||
