답안 #925229

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925229 2024-02-11T06:53:37 Z 12345678 Brunhilda’s Birthday (BOI13_brunhilda) C++17
27.619 / 100
1000 ms 262144 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e7+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 45 ms 156964 KB Output is correct
2 Correct 75 ms 156992 KB Output is correct
3 Correct 39 ms 156764 KB Output is correct
4 Correct 53 ms 157020 KB Output is correct
5 Correct 73 ms 156916 KB Output is correct
6 Correct 31 ms 157004 KB Output is correct
7 Correct 41 ms 156756 KB Output is correct
8 Correct 47 ms 157008 KB Output is correct
9 Correct 99 ms 156760 KB Output is correct
10 Correct 113 ms 156920 KB Output is correct
11 Correct 102 ms 156756 KB Output is correct
12 Correct 52 ms 156912 KB Output is correct
13 Correct 196 ms 156756 KB Output is correct
14 Correct 197 ms 157012 KB Output is correct
15 Correct 85 ms 156752 KB Output is correct
16 Correct 78 ms 156752 KB Output is correct
17 Correct 77 ms 157012 KB Output is correct
18 Correct 53 ms 157012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 675 ms 262144 KB Execution killed with signal 9
2 Execution timed out 2389 ms 262144 KB Time limit exceeded
3 Execution timed out 2565 ms 262144 KB Time limit exceeded
4 Correct 87 ms 156996 KB Output is correct
5 Execution timed out 2394 ms 262144 KB Time limit exceeded
6 Execution timed out 2356 ms 262144 KB Time limit exceeded
7 Execution timed out 2375 ms 262144 KB Time limit exceeded
8 Execution timed out 2360 ms 262144 KB Time limit exceeded
9 Execution timed out 2601 ms 262144 KB Time limit exceeded
10 Execution timed out 2612 ms 262144 KB Time limit exceeded
11 Execution timed out 2583 ms 262144 KB Time limit exceeded
12 Execution timed out 2360 ms 262144 KB Time limit exceeded
13 Execution timed out 2392 ms 262144 KB Time limit exceeded
14 Correct 89 ms 156916 KB Output is correct
15 Execution timed out 2581 ms 262144 KB Time limit exceeded
16 Execution timed out 2379 ms 262144 KB Time limit exceeded
17 Correct 202 ms 156916 KB Output is correct
18 Execution timed out 2462 ms 262144 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2606 ms 262144 KB Time limit exceeded
2 Execution timed out 2661 ms 262144 KB Time limit exceeded
3 Execution timed out 2643 ms 262144 KB Time limit exceeded
4 Execution timed out 2386 ms 262144 KB Time limit exceeded
5 Execution timed out 2389 ms 262144 KB Time limit exceeded
6 Execution timed out 2460 ms 262144 KB Time limit exceeded
7 Execution timed out 2387 ms 262144 KB Time limit exceeded
8 Execution timed out 2590 ms 262144 KB Time limit exceeded
9 Execution timed out 2427 ms 262144 KB Time limit exceeded
10 Execution timed out 2396 ms 262144 KB Time limit exceeded
11 Execution timed out 2350 ms 262144 KB Time limit exceeded
12 Execution timed out 2426 ms 262144 KB Time limit exceeded
13 Execution timed out 2612 ms 262144 KB Time limit exceeded
14 Correct 142 ms 157424 KB Output is correct
15 Execution timed out 2504 ms 262144 KB Time limit exceeded
16 Execution timed out 2593 ms 262144 KB Time limit exceeded
17 Execution timed out 2607 ms 262144 KB Time limit exceeded
18 Execution timed out 2589 ms 262144 KB Time limit exceeded
19 Execution timed out 2366 ms 262144 KB Time limit exceeded
20 Execution timed out 2615 ms 262144 KB Time limit exceeded
21 Correct 159 ms 157524 KB Output is correct
22 Execution timed out 2555 ms 262144 KB Time limit exceeded
23 Execution timed out 2340 ms 262144 KB Time limit exceeded
24 Execution timed out 2389 ms 262144 KB Time limit exceeded
25 Execution timed out 2380 ms 262144 KB Time limit exceeded
26 Execution timed out 2411 ms 262144 KB Time limit exceeded
27 Execution timed out 2632 ms 262144 KB Time limit exceeded
28 Execution timed out 2381 ms 262144 KB Time limit exceeded
29 Execution timed out 2626 ms 262144 KB Time limit exceeded
30 Execution timed out 2403 ms 262144 KB Time limit exceeded
31 Execution timed out 2416 ms 262144 KB Time limit exceeded
32 Execution timed out 2341 ms 262144 KB Time limit exceeded
33 Execution timed out 2333 ms 262144 KB Time limit exceeded
34 Execution timed out 2410 ms 262144 KB Time limit exceeded
35 Execution timed out 2351 ms 262144 KB Time limit exceeded
36 Execution timed out 2529 ms 262144 KB Time limit exceeded
37 Execution timed out 2383 ms 262144 KB Time limit exceeded
38 Execution timed out 2417 ms 262144 KB Time limit exceeded
39 Execution timed out 2374 ms 262144 KB Time limit exceeded
40 Execution timed out 2252 ms 262144 KB Time limit exceeded
41 Execution timed out 2379 ms 262144 KB Time limit exceeded
42 Correct 220 ms 157260 KB Output is correct