# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483295 | ntabc05101 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 221 ms | 79684 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int mxN = 10000000;
int dp[mxN + 1], b[mxN + 1];
int main() {
cin.tie(0)->sync_with_stdio(0);
int m, Q; cin >> m >> Q;
int prs[m];
for (int i = 0; i < m; i++) {
cin >> prs[i];
}
iota(b + 1, b + mxN + 1, 1);
sort(prs, prs + m);
for (int i = 0; i < m; i++) {
for (int j = prs[i]; j <= mxN; j += prs[i]) {
b[j - 1] = j - prs[i];
}
}
int mn = mxN + 1;
for (int i = mxN; i; i--) {
dp[i] = mxN + 1;
mn = min(mn, b[i]);
b[i] = mn;
}
for (int i = 1; i <= mxN; i++) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |