# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900247 | nguyentunglam | Packing Biscuits (IOI20_biscuits) | C++17 | 1088 ms | 600 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>
#define fi first
#define se second
#define endl "\n"
#define ii pair<int, int>
using namespace std;
const int N = 110;
long long a[N];
long long count_tastiness(long long x, vector<long long> A) {
for(int i = 0; i < A.size(); i++) a[i] = A[i];
long long ret = 1;
for(int y = 1; y <= 1e5; y++) {
long long tmp = y;
long long cur = 0;
for(int j = 60; j >= 0; j--) {
cur *= 2;
if (cur > 1e5) break;
if (tmp >> j & 1) cur += x;
cur = max(0LL, cur - a[j]);
}
if (!cur) ret++;
// if (!cur) cout << y << endl;
}
return ret;
}
#ifdef ngu
int main() {
freopen ("task.inp", "r", stdin);
freopen ("task.out", "w", stdout);
int q; cin >> q;
while (q--) {
long long k, x;
cin >> k >> x;
vector<long long> a(k);
for(int i = 0; i < k; i++) cin >> a[i];
cout << count_tastiness(x, a) << endl;
}
}
#endif // ngu
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... |