제출 #400747

#제출 시각아이디문제언어결과실행 시간메모리
400747REALITYNB비스킷 담기 (IOI20_biscuits)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; int count_tastiness(int k,vector<int> a){ int n =120 ; while(n!=a.size()) a.push_back(0) ; vector<int> dp(n+1); dp[n]=1; for(int i=n-1;i>-1;i--){ int sum = 0 ; vector<int> b=a; int stop = i+1; for(int j=i;j<n;j++){ if(b[j]>1){ b[j+1]+=b[j]/2; if(b[j]&1) b[j]=1; else b[j]=0; stop=j+2; } else break ; } if(a[i]==0) { dp[i]+=dp[i+1] ; continue ; } vector<int> in ; for(int j=i;j<stop;j++) if(b[j]) in.push_back(j) ; for(int j=1;j<in.size();j++) dp[i]+=dp[stop]*(1LL<<(in[j-1]-i)); dp[i]+=dp[stop]; dp[i]+=dp[stop]*(1<<(in.back()-i)) ; } return dp[0] ; }

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

biscuits.cpp: In function 'int count_tastiness(int, std::vector<int>)':
biscuits.cpp:6:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     while(n!=a.size()) a.push_back(0) ;
      |           ~^~~~~~~~~~
biscuits.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int j=1;j<in.size();j++)
      |                     ~^~~~~~~~~~
biscuits.cpp:10:13: warning: unused variable 'sum' [-Wunused-variable]
   10 |         int sum = 0 ;
      |             ^~~
/tmp/ccnLmKvs.o: In function `main':
grader.cpp:(.text.startup+0x433): undefined reference to `count_tastiness(long long, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status