Submission #486859

# Submission time Handle Problem Language Result Execution time Memory
486859 2021-11-13T03:23:03 Z huyhoangdz123 Brunhilda’s Birthday (BOI13_brunhilda) C++14
80.3175 / 100
280 ms 79556 KB
//ngqminh.cl2735
/*
🛸     🌎 °  🌓 •  .°•   🚀 ✯
   ★ *     °    🛰  °·                             🪐
.   • ° ★ •  ☄
______________________________________________________
    myv    myv    myv    myv    myv
        BUH BUH LMAO
*/
#include <bits/stdc++.h>
#define PB push_back
#define Random(lf, rt) (lf + rand() % (rt - lf + 1))
#define pii pair <int,int>
#define vi vector <int>
#define vii vector <pii>
#define mpa make_pair
#define oo 1e9 + 1000009
#define F first
#define S second
#define reset(x, i) memset(x,i,sizeof(x))
#define sz(x) int(x.size())
#define maxn 100005
#define maxx 10000007
#define MOD
#define all(x) x.begin(), x.end()
#define cosdo(x) cos((x)/180 * Pi)
#define sindo(x) sin((x)/180 * Pi)
#define tando(x) tan((x)/180 * Pi)
#define cotdo(x) 1/tando(x)
#define Task "BirthDay"
using namespace std;
const double Pi = acos(-1);
typedef long long ll;
typedef long double ld;
int dp[maxx], a[maxn];
int n[maxn], best[maxx];
int m, q;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen(Task".inp", "r", stdin);
//    freopen(Task".out", "w", stdout);
    cin >> m >> q;
    for (int i = 1; i <= m; i ++)
        cin >> a[i];
    for (int i = 1; i <= q; i ++)
        cin >> n[i];
    for (int i = 1; i <= m; i ++)
        for (int j = a[i] - 1; j < maxx; j += a[i])
            best[j] = max(best[j], a[i] - 1);
    for (int i = maxx - 2; i >= 0; i --)
        best[i] = max(best[i], best[i + 1] - 1);
    fill(dp, dp + maxx, oo);
    dp[0] = 0;
    for (int x = 1; x < maxx; x ++)
        dp[x] = dp[x - best[x]] + 1;
    for (int i = 1; i <= q; i ++){
        if(dp[n[i]] > oo) cout << "oo\n";
        else cout << dp[n[i]] << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 91 ms 78532 KB Output is correct
2 Correct 112 ms 78596 KB Output is correct
3 Correct 102 ms 78564 KB Output is correct
4 Correct 90 ms 78532 KB Output is correct
5 Correct 102 ms 78488 KB Output is correct
6 Correct 90 ms 78504 KB Output is correct
7 Correct 100 ms 78532 KB Output is correct
8 Correct 106 ms 78612 KB Output is correct
9 Correct 119 ms 78488 KB Output is correct
10 Correct 133 ms 78500 KB Output is correct
11 Correct 126 ms 78492 KB Output is correct
12 Correct 91 ms 78624 KB Output is correct
13 Correct 219 ms 78532 KB Output is correct
14 Correct 204 ms 78524 KB Output is correct
15 Correct 115 ms 78536 KB Output is correct
16 Correct 110 ms 78504 KB Output is correct
17 Correct 110 ms 78628 KB Output is correct
18 Correct 91 ms 78636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 78552 KB Output is correct
2 Correct 112 ms 78876 KB Output is correct
3 Correct 247 ms 78840 KB Output is correct
4 Correct 119 ms 78504 KB Output is correct
5 Correct 180 ms 78660 KB Output is correct
6 Correct 108 ms 78556 KB Output is correct
7 Correct 106 ms 78588 KB Output is correct
8 Correct 117 ms 78532 KB Output is correct
9 Correct 203 ms 78852 KB Output is correct
10 Correct 253 ms 78772 KB Output is correct
11 Incorrect 244 ms 78648 KB Output isn't correct
12 Correct 148 ms 78576 KB Output is correct
13 Correct 96 ms 78512 KB Output is correct
14 Correct 118 ms 78508 KB Output is correct
15 Correct 205 ms 78748 KB Output is correct
16 Correct 113 ms 78916 KB Output is correct
17 Correct 214 ms 78532 KB Output is correct
18 Correct 214 ms 78916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 216 ms 78972 KB Output is correct
2 Correct 253 ms 78916 KB Output is correct
3 Correct 264 ms 79160 KB Output is correct
4 Incorrect 169 ms 79132 KB Output isn't correct
5 Incorrect 134 ms 79488 KB Output isn't correct
6 Correct 221 ms 79124 KB Output is correct
7 Correct 194 ms 79172 KB Output is correct
8 Correct 213 ms 78996 KB Output is correct
9 Correct 211 ms 78944 KB Output is correct
10 Correct 178 ms 78712 KB Output is correct
11 Incorrect 158 ms 78788 KB Output isn't correct
12 Correct 198 ms 78708 KB Output is correct
13 Correct 245 ms 79228 KB Output is correct
14 Correct 157 ms 79500 KB Output is correct
15 Incorrect 203 ms 78736 KB Output isn't correct
16 Correct 228 ms 78724 KB Output is correct
17 Correct 216 ms 78828 KB Output is correct
18 Correct 256 ms 78916 KB Output is correct
19 Incorrect 105 ms 78648 KB Output isn't correct
20 Correct 267 ms 79044 KB Output is correct
21 Incorrect 175 ms 79556 KB Output isn't correct
22 Correct 263 ms 79524 KB Output is correct
23 Correct 142 ms 79300 KB Output is correct
24 Correct 117 ms 79224 KB Output is correct
25 Correct 184 ms 79272 KB Output is correct
26 Incorrect 167 ms 79188 KB Output isn't correct
27 Correct 280 ms 79292 KB Output is correct
28 Incorrect 116 ms 79280 KB Output isn't correct
29 Correct 246 ms 79528 KB Output is correct
30 Correct 238 ms 79428 KB Output is correct
31 Correct 133 ms 79140 KB Output is correct
32 Incorrect 145 ms 79172 KB Output isn't correct
33 Incorrect 109 ms 79192 KB Output isn't correct
34 Correct 197 ms 79208 KB Output is correct
35 Incorrect 120 ms 79300 KB Output isn't correct
36 Correct 258 ms 79452 KB Output is correct
37 Incorrect 141 ms 79516 KB Output isn't correct
38 Correct 218 ms 79128 KB Output is correct
39 Incorrect 126 ms 79172 KB Output isn't correct
40 Correct 197 ms 79156 KB Output is correct
41 Correct 180 ms 79300 KB Output is correct
42 Correct 235 ms 79372 KB Output is correct