제출 #802514

#제출 시각아이디문제언어결과실행 시간메모리
802514I_Love_EliskaM_비스킷 담기 (IOI20_biscuits)C++14
21 / 100
1091 ms1108 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<n;++i) #define pb push_back #define all(x) x.begin(), x.end() using ll = long long; const int N=1e5+5; bitset<N> bs; ll p2(ll x, vector<ll> a) { while (a.size()<=60) a.pb(0); ll s=1; int k=0; while (k<60 && (a[k]==0 || s>=(1ll<<k))) { s+=(a[k]<<k); ++k; } ll old=s; ll s2=1; for (int t=k; t<60; ++t) { if (!a[t]) continue; if (s2 >= (1ll<<(t-k))) { s2+=(a[t]<<(t-k)); } else { s=s2*old; old=s; s2=1; k=t; --t; } } s=s2*old; old=s; s2=1; return s; } ll f(ll x, vector<ll>&a, int i) { if (i>=a.size()-1) return 1+(a[i]/x); if (a[i]>=x) { a[i+1]+=(a[i]-x)>>1; ll q1=f(x,a,i+1); a[i+1]-=(a[i]-x)>>1; a[i+1]+=(a[i])>>1; ll q2=f(x,a,i+1); a[i+1]-=(a[i])>>1; return q1+q2; } else { a[i+1]+=(a[i])>>1; ll q=f(x,a,i+1); a[i+1]-=(a[i])>>1; return q; } } ll count_tastiness(ll x, vector<ll> a) { if (x==1) { return p2(x,a); } return f(x,a,0); }

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

biscuits.cpp: In function 'll f(ll, std::vector<long long int>&, int)':
biscuits.cpp:41:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     if (i>=a.size()-1) return 1+(a[i]/x);
      |         ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...