# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
309473 | Ruxandra985 | Packing Biscuits (IOI20_biscuits) | C++14 | 84 ms | 1016 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
map <long long , long long> mp[61];
long long s[61];
long long x2;
long long rec (int bit , long long nr){
long long sum = 0;
if (bit < 0)
return 1;
nr = min(nr , s[bit] / x2);
nr = min(nr , (1LL << (bit + 1)));
if (mp[bit].find(nr) != mp[bit].end()){ /// exista deja
return mp[bit][nr];
}
if ((1LL << bit) <= nr){ /// nr tine de s[i], de asta, asta ins ca poate fi bitul 1
sum += rec(bit - 1 , nr - (1LL << bit));
}
/// altfel pui bitul 0 aici
sum += rec (bit - 1 , nr);
mp[bit][nr] = sum;
return sum;
}
long long count_tastiness(long long x, vector<long long> a) {
int i;
x2 = x;
for (i = 0 ; i <= 60 ; i++){
mp[i].clear();
s[i] = 0;
}
s[60] = 0;
for (i = 0 ; i <= 60 ; i++){
if (i < a.size())
s[i] += a[i] * (1LL << i);
if (i)
s[i] += s[i - 1];
}
/// s[i] / x e un fel de maxim posibil sa ai pana la i
return rec(60 , min( s[60] / x , (1LL << 60) ) );
}
컴파일 시 표준 에러 (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... |