# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
151049 | dolphingarlic | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 164 ms | 81032 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC Optimize("O3")
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define MAXN 10000001
typedef long long ll;
using namespace std;
ll dp[MAXN];
int main() {
iostream::sync_with_stdio(false);
cin.tie(0);
int n, q;
cin >> n >> q;
deque<int> dq;
FOR(i, 0, n) {
int k;
cin >> k;
dq.push_back(k);
}
dp[0] = 0;
FOR(i, 1, MAXN) {
dp[i] = INT_MAX;
for (int j = 0; j < n && i % dq.front() == 0; j++) {
dq.push_back(dq.front());
dq.pop_front();
}
dp[i] = dp[i - (i % dq.front())] + 1;
}
FOR(i, 0, q) {
int x;
cin >> x;
if (dp[x] >= INT_MAX) cout << "oo\n";
else cout << dp[x] << '\n';
}
return 0;
}
컴파일 시 표준 에러 (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... |