# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
405785 | ly20 | Packing Biscuits (IOI20_biscuits) | C++17 | 1095 ms | 332 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 "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 40, INF = 1e9;
int mc[MAXN];
long long count_tastiness(long long x, vector<long long> a) {
long long resp = 0;
for(int j = 0; j <= 100000; j++) {
for(int i = 0; i < a.size(); i++) {
mc[i] = a[i];
}
bool ok = true;
for(int i = MAXN - 1; i >= 0; i--) {
long long rq = x;
if((1LL << i) & j == 0) continue;
for(int k = i; k >= 0; k--) {
if(rq > INF) break;
if(mc[i] <= rq) {
rq -= mc[i];
mc[i] = 0;
}
if(mc[i] > rq) {
rq = 0;
mc[i] -= rq;
}
rq *= 2;
}
if(rq != 0) ok = false;
}
if(ok) resp++;
}
return resp;
}
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... |