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() < 60) a.PB(0);
for(int i = 1; i < 60; ++i) {
a[i] = a[i - 1] + (a[i] * (1LL << i));
}
ll cnt = 0;
for(int i = 1; i <= 100 * 1000; ++i) {
ll c = 0;
bool ok = true;
for(int j = 0; j < 60; ++j) {
if((1LL << j) & i) {
c += (1LL << j) * x;
}
if(c > a[j]) ok = false;
}
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... |