Submission #309469

#TimeUsernameProblemLanguageResultExecution timeMemory
309469Ruxandra985비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1105 ms175992 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; map <long long , long long> mp[61]; long long s[61]; long long x2; long long rec (int bit , long long nr){ long long sum = 0; if (bit < 0) return 1; nr = min(nr , s[bit] / x2); if (mp[bit].find(nr) != mp[bit].end()){ /// exista deja return mp[bit][nr]; } if ((1LL << bit) <= nr){ /// nr tine de s[i], de asta, asta ins ca poate fi bitul 1 sum += rec(bit - 1 , nr - (1LL << bit)); } /// altfel pui bitul 0 aici sum += rec (bit - 1 , nr); mp[bit][nr] = sum; return sum; } long long count_tastiness(long long x, vector<long long> a) { int i; x2 = x; for (i = 0 ; i <= 60 ; i++){ mp[i].clear(); s[i] = 0; } s[60] = 0; for (i = 0 ; i <= 60 ; i++){ if (i < a.size()) s[i] += a[i] * (1LL << i); if (i) s[i] += s[i - 1]; } /// s[i] / x e un fel de maxim posibil sa ai pana la i return rec(60 , min( s[60] / x , (1LL << 60) ) ); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:48:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         if (i < a.size())
      |             ~~^~~~~~~~~~
#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...