Submission #483295

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4832952021-10-28 14:32:29ntabc05101Brunhilda’s Birthday (BOI13_brunhilda)C++14
76.35 / 100
221 ms79684 KiB
#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++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...