답안 #27735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27735 2017-07-13T14:38:41 Z top34051 Brunhilda’s Birthday (BOI13_brunhilda) C++14
5.55556 / 100
379 ms 80536 KB
#include<bits/stdc++.h>
using namespace std;
#define slan 10000000
#define inf (int)1e6
int n,m;
int p[100005];
int mx[slan+5];
int mem[slan+5];
main() {
    int i,j,x,val;
    long long mul;
    bool ok;
    scanf("%d%d",&n,&m);
    ok = 0; mul = 1;
    for(i=1;i<=n;i++) {
        scanf("%d",&val);
        x = 0;
        while(x<=slan) mx[x] = max(mx[x],val), x += val;
        mul = mul*val;
        if(mul>=slan) ok = 1;
    }
    for(i=0,j=1;i<=slan;i++) for(j=max(j,i+1);j<i+mx[i];j++) mem[j] = mem[i]+1;
    while(m--) {
        scanf("%d",&x);
        if(x>=mul || ok) printf("oo\n");
        else printf("%d\n",mem[x]);
    }
}

Compilation message

brunhilda.cpp:9:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
brunhilda.cpp: In function 'int main()':
brunhilda.cpp:13:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
                        ^
brunhilda.cpp:16:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&val);
                         ^
brunhilda.cpp:24:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 80536 KB Output is correct
2 Incorrect 56 ms 80536 KB Output isn't correct
3 Correct 66 ms 80536 KB Output is correct
4 Incorrect 43 ms 80536 KB Output isn't correct
5 Incorrect 86 ms 80536 KB Output isn't correct
6 Correct 66 ms 80536 KB Output is correct
7 Correct 89 ms 80536 KB Output is correct
8 Correct 49 ms 80536 KB Output is correct
9 Incorrect 113 ms 80536 KB Output isn't correct
10 Incorrect 99 ms 80536 KB Output isn't correct
11 Incorrect 103 ms 80536 KB Output isn't correct
12 Incorrect 39 ms 80536 KB Output isn't correct
13 Incorrect 223 ms 80536 KB Output isn't correct
14 Incorrect 206 ms 80536 KB Output isn't correct
15 Incorrect 63 ms 80536 KB Output isn't correct
16 Incorrect 86 ms 80536 KB Output isn't correct
17 Incorrect 56 ms 80536 KB Output isn't correct
18 Incorrect 59 ms 80536 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 73 ms 80536 KB Output isn't correct
2 Incorrect 109 ms 80536 KB Output isn't correct
3 Incorrect 319 ms 80536 KB Output isn't correct
4 Incorrect 96 ms 80536 KB Output isn't correct
5 Incorrect 209 ms 80536 KB Output isn't correct
6 Incorrect 73 ms 80536 KB Output isn't correct
7 Incorrect 63 ms 80536 KB Output isn't correct
8 Incorrect 93 ms 80536 KB Output isn't correct
9 Incorrect 239 ms 80536 KB Output isn't correct
10 Incorrect 316 ms 80536 KB Output isn't correct
11 Incorrect 336 ms 80536 KB Output isn't correct
12 Incorrect 156 ms 80536 KB Output isn't correct
13 Incorrect 49 ms 80536 KB Output isn't correct
14 Incorrect 89 ms 80536 KB Output isn't correct
15 Incorrect 276 ms 80536 KB Output isn't correct
16 Incorrect 99 ms 80536 KB Output isn't correct
17 Incorrect 263 ms 80536 KB Output isn't correct
18 Incorrect 256 ms 80536 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 299 ms 80536 KB Output isn't correct
2 Incorrect 286 ms 80536 KB Output isn't correct
3 Incorrect 276 ms 80536 KB Output isn't correct
4 Incorrect 179 ms 80536 KB Output isn't correct
5 Incorrect 133 ms 80536 KB Output isn't correct
6 Incorrect 279 ms 80536 KB Output isn't correct
7 Incorrect 229 ms 80536 KB Output isn't correct
8 Incorrect 236 ms 80536 KB Output isn't correct
9 Incorrect 266 ms 80536 KB Output isn't correct
10 Incorrect 153 ms 80536 KB Output isn't correct
11 Incorrect 166 ms 80536 KB Output isn't correct
12 Incorrect 236 ms 80536 KB Output isn't correct
13 Incorrect 313 ms 80536 KB Output isn't correct
14 Incorrect 169 ms 80536 KB Output isn't correct
15 Incorrect 253 ms 80536 KB Output isn't correct
16 Incorrect 283 ms 80536 KB Output isn't correct
17 Incorrect 236 ms 80536 KB Output isn't correct
18 Incorrect 319 ms 80536 KB Output isn't correct
19 Incorrect 73 ms 80536 KB Output isn't correct
20 Incorrect 329 ms 80536 KB Output isn't correct
21 Incorrect 213 ms 80536 KB Output isn't correct
22 Incorrect 379 ms 80536 KB Output isn't correct
23 Incorrect 119 ms 80536 KB Output isn't correct
24 Incorrect 76 ms 80536 KB Output isn't correct
25 Incorrect 203 ms 80536 KB Output isn't correct
26 Incorrect 166 ms 80536 KB Output isn't correct
27 Incorrect 319 ms 80536 KB Output isn't correct
28 Incorrect 86 ms 80536 KB Output isn't correct
29 Incorrect 323 ms 80536 KB Output isn't correct
30 Incorrect 313 ms 80536 KB Output isn't correct
31 Incorrect 106 ms 80536 KB Output isn't correct
32 Incorrect 136 ms 80536 KB Output isn't correct
33 Incorrect 59 ms 80536 KB Output isn't correct
34 Incorrect 276 ms 80536 KB Output isn't correct
35 Incorrect 96 ms 80536 KB Output isn't correct
36 Incorrect 359 ms 80536 KB Output isn't correct
37 Incorrect 153 ms 80536 KB Output isn't correct
38 Incorrect 269 ms 80536 KB Output isn't correct
39 Incorrect 66 ms 80536 KB Output isn't correct
40 Incorrect 219 ms 80536 KB Output isn't correct
41 Incorrect 213 ms 80536 KB Output isn't correct
42 Incorrect 236 ms 80536 KB Output isn't correct