Submission #810404

#TimeUsernameProblemLanguageResultExecution timeMemory
810404I_Love_EliskaM_Packing Biscuits (IOI20_biscuits)C++17
0 / 100
10 ms364 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; #define pi pair<int,int> #define f first #define s second #define int ll map<int,int> mem; int s[61]; ll x; int f(int n) { if (n<=0) return 0; if (n==1) return 1; if (mem.count(n)) return mem[n]; int p=1; int i=0; while (2*p<n) p<<=1, ++i; int a = f(p); int b = f(min(n, s[i]/x+1)-p); mem[n]=a+b; return mem[n]; } ll count_tastiness(ll _x, vector<ll> a) { x=_x; mem.clear(); forn(i,60) s[i]=0; s[0]=a[0]; forn(i,a.size()) if (i) s[i]=s[i-1]+(a[i]<<i); for (int i=0; i<=60; ++i) f(1ll<<i); return mem[1ll<<60]; } #undef int

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:4:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define forn(i,n) for(int i=0;i<n;++i)
......
   39 |     forn(i,a.size()) if (i) s[i]=s[i-1]+(a[i]<<i);
      |          ~~~~~~~~~~             
biscuits.cpp:39:5: note: in expansion of macro 'forn'
   39 |     forn(i,a.size()) if (i) s[i]=s[i-1]+(a[i]<<i);
      |     ^~~~
#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...