제출 #27735

#제출 시각아이디문제언어결과실행 시간메모리
27735top34051Brunhilda’s Birthday (BOI13_brunhilda)C++14
5.56 / 100
379 ms80536 KiB
#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]);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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);
                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...