제출 #376356

#제출 시각아이디문제언어결과실행 시간메모리
376356Jarif_Rahman비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef unsigned long long int ll; typedef string str; const int kk = 100; ll count_tastiness(ll x, vector<ll> aa){ vector<ll> a(kk); int k = aa.size(); for(int i = 0; i < k; i++) a[i] = aa[i]; ll ans = 0; vector<ll> s(kk, 0); for(int i = 0; i < kk; i++){ if(i != 0) s[i] = s[i-1]; s[i]+=a[i]*(1LL<<i); } vector<ll> v; v.pb({0}); for(int i = 0; i < kk; i++){ ll mx = s[i]/x-mx, p = 1; p<<=i; mx-=p; int in = upper_bound(v.begin(), v.end(), mx) - v.begin(); for(int j = 0; j < in; j++) v.pb(v[j]+p); } return v.size(); }

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

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long unsigned int>)':
biscuits.cpp:14:8: warning: unused variable 'ans' [-Wunused-variable]
   14 |     ll ans = 0;
      |        ^~~
biscuits.cpp:23:12: warning: 'mx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         ll mx = s[i]/x-mx, p = 1;
      |            ^~
/tmp/ccnpZHEI.o: In function `main':
grader.cpp:(.text.startup+0x439): undefined reference to `count_tastiness(long long, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status