Submission #825222

#TimeUsernameProblemLanguageResultExecution timeMemory
825222fatemetmhrPacking Biscuits (IOI20_biscuits)C++17
12 / 100
19 ms440 KiB
// ~ Be Name Khoda ~ // #include "biscuits.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,Ofast") using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 1.2e6 + 10; const int maxn3 = 1e3 + 10; const int mod = 1e9 + 7; const ll inf = 1e18; ll x, sum[100], a[100]; vector <ll> solve(int i, vector <ll> need){ vector <ll> av; if(i == -1){ av.resize(int(need.size()) + 1); fill(all(av), 1); return av; } for(int j = 0; j < need.size(); j++) need[j] = min(need[j], sum[i]); need.pb(sum[i]); //cout << i << ' ' << need.size() << ' ' << sum[i] << endl; for(auto y : need){ if(y >= (1ll << i) * x) av.pb(y - (1ll << i) * x); else av.pb(y); } av = solve(i - 1, av); for(int j = 0; j < int(av.size()) - 1; j++){ if(need[j] >= (1ll << i) * x) av[j] += av.back(); //cout << "* " << i << ' ' << j << ' ' << need[j] << ' ' << av[j] << endl; } av.pop_back(); return av; } long long count_tastiness(long long xx, std::vector<long long> aa) { x = xx; for(int i = 0; i < int(aa.size()); i++){ a[i] = aa[i]; sum[i] = a[i] * (1ll << i); if(i) sum[i] += sum[i - 1]; } for(int i = aa.size(); i < 60; i++) sum[i] = sum[i - 1]; vector <ll> av; av = solve(59, av); //cout << "hey " << av.size() << endl; return av.back(); }

Compilation message (stderr)

biscuits.cpp: In function 'std::vector<long long int> solve(int, std::vector<long long int>)':
biscuits.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |  for(int j = 0; j < need.size(); j++)
      |                 ~~^~~~~~~~~~~~~
#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...