Submission #1178969

#TimeUsernameProblemLanguageResultExecution timeMemory
1178969browntoadPacking Biscuits (IOI20_biscuits)C++20
44 / 100
251 ms4072 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; #define ll long long // #define int ll #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n+1) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define pii pair<int, int> #define f first #define s second #define pb push_back #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int)((x).size()) const ll maxn = 1e5+5; const int bloc = 101; long long count_tastiness(long long x, std::vector<long long> a) { ll mxval = 0; REP(i, SZ(a)){ mxval += (1ll<<i) * a[i]; } mxval /= x; //ll cnt = 1; vector<ll> okie(400000); okie[0] = 0; ll cur = 0, ptr = 1; for (int j = 0; j < 60;j++){ if (j < SZ(a)) cur += a[j] * (1ll<<j); if ((1ll<<j) > mxval) break; ll optr = ptr, v; REP(i, optr){ v = okie[i]; if (v + (1ll<<j) > mxval) break; if ((v + (1ll<<j))*x > cur) break; okie[ptr++] = (v|(1ll<<j)); } } return ptr; //return 0; }
#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...