이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
#define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;
const int MAXK = 60;
int a[MAXK + 10];
int val[MAXK + 10];
long long count_tastiness(long long x, std::vector<long long> _a) {
int k = sz(_a);
memset(a, 0, sizeof(a));
memset(val, 0, sizeof(val));
For(i, 0, k - 1) {
a[i] = _a[i];
val[i] = a[i] << i;
}
k = 60;
For(i, 1, k) {
val[i] += val[i - 1];
}
int lim = val[k] / x;
vector<int> v;
v.eb(val[k]);
For(i, 0, k - 1) {
if((1ll << i) > lim) break;
int n = sz(v);
For(j, 0, n - 1) {
int y = v[j];
if(val[k] - y + (x << i) <= val[i]) {
v.eb(y - (x << i));
} else {
break;
}
}
}
return sz(v);
}
| # | 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... |