Submission #996298

#TimeUsernameProblemLanguageResultExecution timeMemory
996298vqpahmadPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1 ms348 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #ifdef ONPC #include"debug.h" #else #define debug(...) 42 #endif #define ll long long #define pii pair<int,int> #define F first #define S second #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } const int mod = 1e9 + 7; const int MAXN = 1e6 + 15; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; long long count_tastiness(long long n, std::vector<long long> a) { a.resize(100); int ans = 0; for (int k = 0; k <= 100000; k++){ bool good = 1; for (int i = 0; i < 63; i++){ ll more = a[i] - (k >> i&1) * n; more &= good >= 0; a[i + 1] += more / 2; } if (good) ans++; } return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:31:17: warning: comparison of constant '0' with boolean expression is always true [-Wbool-compare]
   31 |    more &= good >= 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...