Submission #483251

# Submission time Handle Problem Language Result Execution time Memory
483251 2021-10-28T11:13:36 Z David_M Brunhilda’s Birthday (BOI13_brunhilda) C++14
80.3175 / 100
592 ms 157676 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e7+5;
ll m, q, x, u=N, a[N+5], b[N+5], j;
main(){
	cin>>m>>q;
	for (int i=1; i<=u+1; i++)a[i]=b[i]=u;
	for (int i=1; i<=m&&!(j*=0); i++)
        for (cin>>x; j+x-1<=u; j+=x)a[j+x-1]=min(a[j+x-1],j);
	for (int i=u; i; i--)a[i]=min(a[i],a[i+1]);
	for (int i=1; i<=u; i++)b[i]=b[a[i]]+1;
	while(cin>>x)
        if(b[x]<u)cout<<b[x]<<'\n';
        else cout<<"oo\n";
}

Compilation message

brunhilda.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 123 ms 156740 KB Output is correct
2 Correct 171 ms 156948 KB Output is correct
3 Correct 137 ms 156736 KB Output is correct
4 Correct 126 ms 156824 KB Output is correct
5 Correct 140 ms 156824 KB Output is correct
6 Correct 121 ms 156740 KB Output is correct
7 Correct 135 ms 156828 KB Output is correct
8 Correct 144 ms 156824 KB Output is correct
9 Correct 180 ms 156740 KB Output is correct
10 Correct 203 ms 156788 KB Output is correct
11 Correct 167 ms 156836 KB Output is correct
12 Correct 120 ms 156740 KB Output is correct
13 Correct 259 ms 156828 KB Output is correct
14 Correct 309 ms 156832 KB Output is correct
15 Correct 156 ms 156740 KB Output is correct
16 Correct 159 ms 156724 KB Output is correct
17 Correct 160 ms 156836 KB Output is correct
18 Correct 136 ms 156956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 141 ms 156912 KB Output is correct
2 Correct 171 ms 156844 KB Output is correct
3 Correct 360 ms 156960 KB Output is correct
4 Correct 172 ms 156752 KB Output is correct
5 Correct 277 ms 157064 KB Output is correct
6 Correct 168 ms 156852 KB Output is correct
7 Correct 145 ms 156916 KB Output is correct
8 Correct 172 ms 156836 KB Output is correct
9 Correct 351 ms 156968 KB Output is correct
10 Correct 382 ms 157024 KB Output is correct
11 Incorrect 378 ms 157004 KB Output isn't correct
12 Correct 264 ms 156840 KB Output is correct
13 Correct 136 ms 156852 KB Output is correct
14 Correct 187 ms 156740 KB Output is correct
15 Correct 348 ms 157088 KB Output is correct
16 Correct 183 ms 157084 KB Output is correct
17 Correct 301 ms 156764 KB Output is correct
18 Correct 343 ms 157088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 364 ms 157124 KB Output is correct
2 Correct 411 ms 157084 KB Output is correct
3 Correct 478 ms 157208 KB Output is correct
4 Incorrect 398 ms 157228 KB Output isn't correct
5 Incorrect 368 ms 157164 KB Output isn't correct
6 Correct 464 ms 157352 KB Output is correct
7 Correct 380 ms 157080 KB Output is correct
8 Correct 410 ms 157108 KB Output is correct
9 Correct 403 ms 157080 KB Output is correct
10 Correct 286 ms 156940 KB Output is correct
11 Incorrect 246 ms 157068 KB Output isn't correct
12 Correct 312 ms 157080 KB Output is correct
13 Correct 533 ms 157340 KB Output is correct
14 Correct 413 ms 157644 KB Output is correct
15 Incorrect 312 ms 157072 KB Output isn't correct
16 Correct 350 ms 157080 KB Output is correct
17 Correct 343 ms 157092 KB Output is correct
18 Correct 461 ms 157096 KB Output is correct
19 Incorrect 193 ms 157052 KB Output isn't correct
20 Correct 494 ms 157184 KB Output is correct
21 Incorrect 396 ms 157676 KB Output isn't correct
22 Correct 592 ms 157300 KB Output is correct
23 Correct 332 ms 157224 KB Output is correct
24 Correct 304 ms 157240 KB Output is correct
25 Correct 437 ms 157400 KB Output is correct
26 Incorrect 364 ms 157296 KB Output isn't correct
27 Correct 505 ms 157084 KB Output is correct
28 Incorrect 316 ms 157324 KB Output isn't correct
29 Correct 540 ms 157240 KB Output is correct
30 Correct 501 ms 157192 KB Output is correct
31 Correct 310 ms 157208 KB Output is correct
32 Incorrect 341 ms 157352 KB Output isn't correct
33 Incorrect 296 ms 157280 KB Output isn't correct
34 Correct 415 ms 157104 KB Output is correct
35 Incorrect 314 ms 157348 KB Output isn't correct
36 Correct 557 ms 157208 KB Output is correct
37 Incorrect 342 ms 157240 KB Output isn't correct
38 Correct 481 ms 157344 KB Output is correct
39 Incorrect 317 ms 157248 KB Output isn't correct
40 Correct 399 ms 157220 KB Output is correct
41 Correct 330 ms 157152 KB Output is correct
42 Correct 449 ms 157476 KB Output is correct