제출 #802512

#제출 시각아이디문제언어결과실행 시간메모리
802512I_Love_EliskaM_비스킷 담기 (IOI20_biscuits)C++14
21 / 100
6 ms464 KiB
#include "biscuits.h" #pragma GCC optimize("O3") #pragma GCC target("avx2") #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; } } int v[2][2*N]; int sz[2]; ll count_tastiness(ll x, vector<ll> a) { if (x==1) { return p2(x,a); } sz[0]=1; v[0][0]=0; int n=a.size(); forn(i,n) { int b=i&1; sz[!b]=0; forn(t,sz[b]) { if (a[i]+v[b][t]<x) { v[!b][sz[!b]]=(a[i]+v[b][t])>>1; sz[!b]++; } else { v[!b][sz[!b]]=(a[i]+v[b][t]-x)>>1; sz[!b]++; v[!b][sz[!b]]=(a[i]+v[b][t])>>1; sz[!b]++; } } } int ans = sz[n&1]; forn(t,sz[n&1]) ans+=v[n&1][t]/x; return ans; }

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

biscuits.cpp: In function 'll f(ll, std::vector<long long int>&, int)':
biscuits.cpp:43:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     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...