Submission #925227

# Submission time Handle Problem Language Result Execution time Memory
925227 2024-02-11T06:50:52 Z 12345678 Brunhilda’s Birthday (BOI13_brunhilda) C++17
11.746 / 100
203 ms 159060 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=1e7+5;
int dp[nx], n, m, x, q, p, res[nx], t, cnt;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>m>>q;
    for (int i=0; i<m; i++)
    {
        cin>>x;
        for (int j=x; j<nx; j+=x) dp[j]=x;
    }
    for (int i=x; i<nx; i++) res[i]=-1;
    for (int i=0; i<x; i++) res[x]=1;
    t=1;
    while (p<nx)
    {
        int mx=x;
        t++;
        for (int i=p; i<x; i++) mx=max(mx, i+dp[i]);
        for (int i=x; i<min(nx-1, mx); i++) res[i]=t;
        if (mx==x) break;
        p=x;
        x=mx;
    }
    while (q--)
    {
        cin>>x;
        if (res[x]==-1) cout<<"oo\n";
        else cout<<res[x]<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 78680 KB Output isn't correct
2 Incorrect 39 ms 78684 KB Output isn't correct
3 Correct 20 ms 78724 KB Output is correct
4 Incorrect 35 ms 78932 KB Output isn't correct
5 Incorrect 38 ms 78684 KB Output isn't correct
6 Incorrect 18 ms 78684 KB Output isn't correct
7 Correct 20 ms 78684 KB Output is correct
8 Correct 23 ms 78672 KB Output is correct
9 Correct 49 ms 78468 KB Output is correct
10 Correct 58 ms 78676 KB Output is correct
11 Correct 57 ms 78672 KB Output is correct
12 Incorrect 28 ms 78700 KB Output isn't correct
13 Incorrect 94 ms 78684 KB Output isn't correct
14 Incorrect 94 ms 78716 KB Output isn't correct
15 Incorrect 44 ms 78936 KB Output isn't correct
16 Incorrect 38 ms 78708 KB Output isn't correct
17 Incorrect 39 ms 78676 KB Output isn't correct
18 Incorrect 29 ms 78680 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Runtime error 96 ms 154704 KB Execution killed with signal 11
2 Runtime error 85 ms 88208 KB Execution killed with signal 11
3 Runtime error 176 ms 142164 KB Execution killed with signal 11
4 Runtime error 103 ms 158920 KB Execution killed with signal 11
5 Runtime error 136 ms 150416 KB Execution killed with signal 11
6 Runtime error 99 ms 158776 KB Execution killed with signal 11
7 Runtime error 95 ms 154536 KB Execution killed with signal 11
8 Runtime error 102 ms 159040 KB Execution killed with signal 11
9 Runtime error 148 ms 150612 KB Execution killed with signal 11
10 Runtime error 179 ms 142208 KB Execution killed with signal 11
11 Runtime error 172 ms 154704 KB Execution killed with signal 11
12 Correct 61 ms 78416 KB Output is correct
13 Runtime error 92 ms 158800 KB Execution killed with signal 11
14 Runtime error 103 ms 158924 KB Execution killed with signal 11
15 Runtime error 151 ms 154600 KB Execution killed with signal 11
16 Runtime error 77 ms 88144 KB Execution killed with signal 11
17 Correct 116 ms 78416 KB Output is correct
18 Runtime error 149 ms 121252 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 156 ms 154708 KB Execution killed with signal 11
2 Runtime error 195 ms 154760 KB Execution killed with signal 11
3 Runtime error 180 ms 154760 KB Execution killed with signal 11
4 Incorrect 83 ms 79188 KB Output isn't correct
5 Runtime error 97 ms 125520 KB Execution killed with signal 11
6 Runtime error 157 ms 158852 KB Execution killed with signal 11
7 Runtime error 139 ms 137916 KB Execution killed with signal 11
8 Runtime error 158 ms 154588 KB Execution killed with signal 11
9 Runtime error 156 ms 154768 KB Execution killed with signal 11
10 Runtime error 134 ms 158860 KB Execution killed with signal 11
11 Runtime error 120 ms 159060 KB Execution killed with signal 11
12 Runtime error 150 ms 158916 KB Execution killed with signal 11
13 Runtime error 169 ms 154764 KB Execution killed with signal 11
14 Correct 76 ms 79956 KB Output is correct
15 Runtime error 153 ms 158804 KB Execution killed with signal 11
16 Runtime error 167 ms 158920 KB Execution killed with signal 11
17 Runtime error 181 ms 154708 KB Execution killed with signal 11
18 Runtime error 180 ms 154708 KB Execution killed with signal 11
19 Runtime error 95 ms 154876 KB Execution killed with signal 11
20 Runtime error 181 ms 154708 KB Execution killed with signal 11
21 Correct 83 ms 79996 KB Output is correct
22 Runtime error 203 ms 150516 KB Execution killed with signal 11
23 Runtime error 104 ms 154768 KB Execution killed with signal 11
24 Runtime error 91 ms 158680 KB Execution killed with signal 11
25 Runtime error 133 ms 158928 KB Execution killed with signal 11
26 Incorrect 88 ms 79440 KB Output isn't correct
27 Runtime error 193 ms 146308 KB Execution killed with signal 11
28 Runtime error 100 ms 158804 KB Execution killed with signal 11
29 Runtime error 171 ms 150392 KB Execution killed with signal 11
30 Runtime error 160 ms 154704 KB Execution killed with signal 11
31 Runtime error 101 ms 158804 KB Execution killed with signal 11
32 Runtime error 111 ms 158860 KB Execution killed with signal 11
33 Runtime error 110 ms 158920 KB Execution killed with signal 11
34 Runtime error 163 ms 138072 KB Execution killed with signal 11
35 Runtime error 99 ms 158924 KB Execution killed with signal 11
36 Runtime error 180 ms 150392 KB Execution killed with signal 11
37 Runtime error 96 ms 125524 KB Execution killed with signal 11
38 Runtime error 148 ms 158848 KB Execution killed with signal 11
39 Runtime error 97 ms 158804 KB Execution killed with signal 11
40 Runtime error 137 ms 159060 KB Execution killed with signal 11
41 Runtime error 109 ms 104840 KB Execution killed with signal 11
42 Runtime error 161 ms 158800 KB Execution killed with signal 11