Submission #27005

#TimeUsernameProblemLanguageResultExecution timeMemory
27005noobprogrammerBrunhilda’s Birthday (BOI13_brunhilda)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std ; int n , m , pr[100010] ;// mx[10000010] , cnt[10000010] , ptr , dp[10000010] ; vector<int> srt[10000010] ; const int N = 1e6 ; int main(){ // freopen("in.txt" , "r" , stdin) ; // freopen("out.txt" , "w" , stdout) ; return 0 ; scanf("%d%d" , &n,&m ) ; for(int i=0;i<n;i++) { scanf("%d" , pr+i) ; for(int j=0 ; j <= (int)1e7 ; j+=pr[i]) mx[j] = max(mx[j] , pr[i]) ; } srt[mx[0] - 1].push_back(1) ; cnt[1]++ ; int val = 1 ; for(int i=1;i<=N;i++){ while(!cnt[val] && val <= 1e7 ) val++ ; dp[i] = val ; for(int v : srt[i]) cnt[v]-- ; srt[i].erase(srt[i].begin() , srt[i].end() ) ; if(dp[i] == 1e7+1) continue ; if(!mx[i]) continue ; srt[i+mx[i]-1].push_back(dp[i]+1) ; cnt[dp[i]+1]++ ; } for(int i=0;i<m;i++){ scanf("%d" , &val) ; if(dp[val] == 1e7+1) printf("oo\n") ; else printf("%d\n" , dp[val] ) ; } }

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:15:43: error: 'mx' was not declared in this scope
   for(int j=0 ; j <= (int)1e7 ; j+=pr[i]) mx[j] = max(mx[j] , pr[i]) ;
                                           ^
brunhilda.cpp:17:6: error: 'mx' was not declared in this scope
  srt[mx[0] - 1].push_back(1) ; cnt[1]++ ;
      ^
brunhilda.cpp:17:32: error: 'cnt' was not declared in this scope
  srt[mx[0] - 1].push_back(1) ; cnt[1]++ ;
                                ^
brunhilda.cpp:21:3: error: 'dp' was not declared in this scope
   dp[i] = val ;
   ^
brunhilda.cpp:30:6: error: 'dp' was not declared in this scope
   if(dp[val] == 1e7+1) printf("oo\n") ;
      ^
brunhilda.cpp:12:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d" , &n,&m ) ;
                         ^
brunhilda.cpp:14:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , pr+i) ;
                      ^
brunhilda.cpp:29:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d" , &val) ;
                      ^