# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
30900 | Navick | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 843 ms | 158268 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int, int>
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 1e7 + 10, INF = 1e9;
int dp[N], p[N], rm[2 * N];
int main(){
int m, q; scanf("%d %d", &m, &q);
for(int i=0; i<m; i++){
scanf("%d", p + i);
for(int k=p[i] - 1; k<2 * N; k+=p[i])
rm[k] = p[i] - 1;
}
for(int i=2*N-1; i>=1; i--)
rm[i] = max(rm[i], rm[i + 1] - 1);
for(int i=1; i<N; i++){
if(rm[i] == 0){
break;
}else{
dp[i] = dp[i - rm[i]] + 1;
}
}
for(int i=0; i<q; i++){
int n; scanf("%d", &n);
if(dp[n] == 0)
printf("oo\n");
else printf("%d\n", dp[n]);
}
}
컴파일 시 표준 에러 (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... |