This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
//#pragma GCC optimize ("O3")
//#pragma GCC target("tune=native")
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
ll count_tastiness(ll x, vector<ll>a) {
while((int)a.size() < 64) a.PB(0);
ll cnt = 0;
for(int i = 1; i <= 100 * 1000; ++i) {
ll c = 0;
bool ok = true;
for(int j = 0; j < 64; ++j) {
c += a[j];
if((1LL << j) & i) {
if(c < x) {
ok = false;
break;
}
c -= x;
}
c /= 2;
}
cnt += ok;
}
return cnt+1;
}
//int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
//cout << count_tastiness(2, {2, 1, 2}) << "\n";
//cout << count_tastiness(3, {5, 2, 1}) << "\n";
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |