이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
int num;
vector<ll> arr;
vector<ll> memo;
long long count_tastiness(long long N, std::vector<long long> ARR) {
num=N,arr=ARR;
ll mx;
memo={0};
rep(x,0,sz(arr)){
int temp=sz(memo);
mx=0;
rep(y,0,temp){
ll curr=memo[y]+arr[x];
if (curr>=num) memo.push_back((curr-num)>>1);
memo[y]=curr>>1;
mx=max(mx,memo[y]);
}
}
while (mx>=num){
int temp=sz(memo);
mx=0;
rep(y,0,temp){
if (memo[y]>=num) memo.push_back((memo[y]-num)>>1);
memo[y]>>=1;
mx=max(mx,memo[y]);
}
}
return sz(memo);
}
# | 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... |