# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082788 | beaconmc | Packing Biscuits (IOI20_biscuits) | C++14 | 1071 ms | 348 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>
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
vector<ll> temp = a;
ll ans = 0;
FOR(i,0,30) a.push_back(0);
FOR(i,0,a.size()-1){
while (a[i]>2) a[i+1] += 1, a[i] -= 2;
}
if (x>100005) return 1;
FOR(req,0,100005/x + 2){
a = temp;
bool flag = false;
FOR(k,0,x){
ll sus = 0;
FORNEG(i,a.size()-1, -1){
while (sus + (1<<i) <= req && a[i]) sus += (1<<i), a[i]--;
}
if (sus != req){
flag = true;
break;
}
}
if (!flag)ans++;
}
return ans;
}
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... |