답안 #925228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925228 2024-02-11T06:52:20 Z 12345678 Brunhilda’s Birthday (BOI13_brunhilda) C++17
27.9365 / 100
191 ms 159316 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[i]=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;
    }
    //for (int i=0; i<35; i++) cout<<i<<' '<<res[i]<<'\n';
    while (q--)
    {
        cin>>x;
        if (res[x]==-1) cout<<"oo\n";
        else cout<<res[x]<<'\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 78684 KB Output is correct
2 Correct 36 ms 78684 KB Output is correct
3 Correct 20 ms 78684 KB Output is correct
4 Correct 27 ms 78680 KB Output is correct
5 Correct 35 ms 78684 KB Output is correct
6 Correct 16 ms 78684 KB Output is correct
7 Correct 22 ms 78684 KB Output is correct
8 Correct 23 ms 78684 KB Output is correct
9 Correct 48 ms 78684 KB Output is correct
10 Correct 55 ms 78712 KB Output is correct
11 Correct 52 ms 78676 KB Output is correct
12 Correct 27 ms 78684 KB Output is correct
13 Correct 90 ms 78472 KB Output is correct
14 Correct 92 ms 78672 KB Output is correct
15 Correct 41 ms 78684 KB Output is correct
16 Correct 36 ms 78736 KB Output is correct
17 Correct 37 ms 78684 KB Output is correct
18 Correct 27 ms 78684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 92 ms 159108 KB Execution killed with signal 11
2 Runtime error 104 ms 159060 KB Execution killed with signal 11
3 Runtime error 176 ms 159060 KB Execution killed with signal 11
4 Runtime error 101 ms 159160 KB Execution killed with signal 11
5 Runtime error 137 ms 159156 KB Execution killed with signal 11
6 Runtime error 96 ms 159056 KB Execution killed with signal 11
7 Runtime error 93 ms 159060 KB Execution killed with signal 11
8 Runtime error 102 ms 159060 KB Execution killed with signal 11
9 Runtime error 158 ms 159116 KB Execution killed with signal 11
10 Runtime error 177 ms 159112 KB Execution killed with signal 11
11 Runtime error 168 ms 159060 KB Execution killed with signal 11
12 Correct 61 ms 78712 KB Output is correct
13 Runtime error 89 ms 159056 KB Execution killed with signal 11
14 Runtime error 104 ms 159096 KB Execution killed with signal 11
15 Runtime error 152 ms 159060 KB Execution killed with signal 11
16 Runtime error 103 ms 159060 KB Execution killed with signal 11
17 Correct 95 ms 78720 KB Output is correct
18 Runtime error 157 ms 159104 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Runtime error 157 ms 159316 KB Execution killed with signal 11
2 Runtime error 173 ms 159100 KB Execution killed with signal 11
3 Runtime error 174 ms 159060 KB Execution killed with signal 11
4 Correct 91 ms 78976 KB Output is correct
5 Runtime error 105 ms 159148 KB Execution killed with signal 11
6 Runtime error 146 ms 159284 KB Execution killed with signal 11
7 Runtime error 148 ms 159056 KB Execution killed with signal 11
8 Runtime error 157 ms 159096 KB Execution killed with signal 11
9 Runtime error 150 ms 159056 KB Execution killed with signal 11
10 Runtime error 127 ms 159056 KB Execution killed with signal 11
11 Runtime error 115 ms 159080 KB Execution killed with signal 11
12 Runtime error 137 ms 159104 KB Execution killed with signal 11
13 Runtime error 164 ms 159096 KB Execution killed with signal 11
14 Correct 83 ms 79088 KB Output is correct
15 Runtime error 144 ms 159060 KB Execution killed with signal 11
16 Runtime error 167 ms 159176 KB Execution killed with signal 11
17 Runtime error 144 ms 159044 KB Execution killed with signal 11
18 Runtime error 174 ms 159156 KB Execution killed with signal 11
19 Runtime error 91 ms 159116 KB Execution killed with signal 11
20 Runtime error 167 ms 159084 KB Execution killed with signal 11
21 Correct 80 ms 79184 KB Output is correct
22 Runtime error 181 ms 159056 KB Execution killed with signal 11
23 Runtime error 98 ms 159180 KB Execution killed with signal 11
24 Runtime error 94 ms 159216 KB Execution killed with signal 11
25 Runtime error 122 ms 159056 KB Execution killed with signal 11
26 Correct 79 ms 78932 KB Output is correct
27 Runtime error 191 ms 159060 KB Execution killed with signal 11
28 Runtime error 95 ms 159276 KB Execution killed with signal 11
29 Runtime error 167 ms 159100 KB Execution killed with signal 11
30 Runtime error 150 ms 159060 KB Execution killed with signal 11
31 Runtime error 100 ms 159060 KB Execution killed with signal 11
32 Runtime error 105 ms 159204 KB Execution killed with signal 11
33 Runtime error 85 ms 159192 KB Execution killed with signal 11
34 Runtime error 146 ms 159060 KB Execution killed with signal 11
35 Runtime error 95 ms 159060 KB Execution killed with signal 11
36 Runtime error 171 ms 159096 KB Execution killed with signal 11
37 Runtime error 109 ms 159124 KB Execution killed with signal 11
38 Runtime error 156 ms 159056 KB Execution killed with signal 11
39 Runtime error 96 ms 159108 KB Execution killed with signal 11
40 Runtime error 129 ms 159104 KB Execution killed with signal 11
41 Runtime error 136 ms 159060 KB Execution killed with signal 11
42 Runtime error 162 ms 159316 KB Execution killed with signal 11