# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604764 | Sam_a17 | Packing Biscuits (IOI20_biscuits) | C++14 | 1082 ms | 3636 KiB |
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>
using namespace std;
#define sz(x) (int((x).size()))
#define len(x) (int)x.length()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dbg(x) cout << #x << " " << x << endl;
#define uniq(x) x.resize(unique(all(x)) - x.begin());
#define pb push_back
#define ld long double
#define ll long long
// #include "mushrooms.h"
int use_machine(vector<int> m);
template<typename T>
void pr(vector<T>& a) {
cerr << "arr" << " ";
for(auto i: a) {
cerr << i << " ";
} cerr << endl;
}
const int N = 1e5 + 10;
vector<int> adj[N], order;
long long count_tastiness(long long x, std::vector<long long> a) {
int k = sz(a);
// pr(a);
// dbg(x)
vector<int> answ{0};
for(long long i = 1; i < N; i++) {
// check if we can get y
vector<long long> new_a(62);
for(int j = 0; j < sz(a); j++) {
new_a[j] += a[j];
}
bool flag = true;
for(int j = 0; j < 60; j++) {
if(i & (1ll << j) && new_a[j] >= x) {
new_a[j] -= x;
} else if(i & (1ll << j) && new_a[j] < x) {
flag = false;
break;
}
new_a[j + 1] += new_a[j] / 2;
}
if(flag) {
// dbg(i)
answ.push_back(i);
}
}
return sz(answ);
}
Compilation message (stderr)
# | 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... |