답안 #483259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
483259 2021-10-28T11:17:04 Z David_M Brunhilda’s Birthday (BOI13_brunhilda) C++14
100 / 100
629 ms 235720 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=15000000;
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(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 235076 KB Output is correct
2 Correct 211 ms 235092 KB Output is correct
3 Correct 197 ms 235084 KB Output is correct
4 Correct 178 ms 235152 KB Output is correct
5 Correct 194 ms 235076 KB Output is correct
6 Correct 192 ms 235196 KB Output is correct
7 Correct 194 ms 235076 KB Output is correct
8 Correct 207 ms 234992 KB Output is correct
9 Correct 241 ms 235208 KB Output is correct
10 Correct 261 ms 235104 KB Output is correct
11 Correct 245 ms 235076 KB Output is correct
12 Correct 166 ms 235076 KB Output is correct
13 Correct 415 ms 235076 KB Output is correct
14 Correct 402 ms 235156 KB Output is correct
15 Correct 221 ms 235080 KB Output is correct
16 Correct 210 ms 235048 KB Output is correct
17 Correct 216 ms 235204 KB Output is correct
18 Correct 179 ms 235124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 191 ms 235076 KB Output is correct
2 Correct 230 ms 235364 KB Output is correct
3 Correct 472 ms 235344 KB Output is correct
4 Correct 221 ms 235104 KB Output is correct
5 Correct 343 ms 235040 KB Output is correct
6 Correct 201 ms 235104 KB Output is correct
7 Correct 191 ms 235108 KB Output is correct
8 Correct 236 ms 235016 KB Output is correct
9 Correct 388 ms 235048 KB Output is correct
10 Correct 483 ms 235152 KB Output is correct
11 Correct 450 ms 235076 KB Output is correct
12 Correct 288 ms 235200 KB Output is correct
13 Correct 185 ms 235108 KB Output is correct
14 Correct 224 ms 235076 KB Output is correct
15 Correct 420 ms 235104 KB Output is correct
16 Correct 223 ms 235076 KB Output is correct
17 Correct 392 ms 235052 KB Output is correct
18 Correct 399 ms 235100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 498 ms 235104 KB Output is correct
2 Correct 500 ms 235116 KB Output is correct
3 Correct 556 ms 235204 KB Output is correct
4 Correct 434 ms 235240 KB Output is correct
5 Correct 385 ms 235212 KB Output is correct
6 Correct 514 ms 235376 KB Output is correct
7 Correct 424 ms 235204 KB Output is correct
8 Correct 463 ms 235204 KB Output is correct
9 Correct 449 ms 235076 KB Output is correct
10 Correct 347 ms 235144 KB Output is correct
11 Correct 300 ms 235148 KB Output is correct
12 Correct 405 ms 235188 KB Output is correct
13 Correct 563 ms 235332 KB Output is correct
14 Correct 423 ms 235720 KB Output is correct
15 Correct 421 ms 235100 KB Output is correct
16 Correct 450 ms 235104 KB Output is correct
17 Correct 396 ms 235232 KB Output is correct
18 Correct 504 ms 235060 KB Output is correct
19 Correct 225 ms 235220 KB Output is correct
20 Correct 545 ms 235196 KB Output is correct
21 Correct 473 ms 235656 KB Output is correct
22 Correct 617 ms 235240 KB Output is correct
23 Correct 369 ms 235328 KB Output is correct
24 Correct 326 ms 235384 KB Output is correct
25 Correct 460 ms 235416 KB Output is correct
26 Correct 433 ms 235352 KB Output is correct
27 Correct 629 ms 235104 KB Output is correct
28 Correct 348 ms 235332 KB Output is correct
29 Correct 585 ms 235204 KB Output is correct
30 Correct 539 ms 235348 KB Output is correct
31 Correct 355 ms 235352 KB Output is correct
32 Correct 370 ms 235316 KB Output is correct
33 Correct 309 ms 235332 KB Output is correct
34 Correct 429 ms 235288 KB Output is correct
35 Correct 349 ms 235348 KB Output is correct
36 Correct 602 ms 235304 KB Output is correct
37 Correct 390 ms 235204 KB Output is correct
38 Correct 513 ms 235364 KB Output is correct
39 Correct 357 ms 235476 KB Output is correct
40 Correct 460 ms 235332 KB Output is correct
41 Correct 403 ms 235112 KB Output is correct
42 Correct 568 ms 235388 KB Output is correct