# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
789439 | borisAngelov | 비스킷 담기 (IOI20_biscuits) | C++17 | 1084 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x, vector<long long> a)
{
int sum = 0;
for (int i = 0; i < a.size(); ++i)
{
sum += a[i] * (1LL << i);
}
int bits = 60;
int up_to = sum / x;
int ans = 0;
for (int i = 0; i <= up_to; ++i)
{
vector<int> cnt(20, 0);
for (int j = 0; j <= 16; ++j)
{
if (j < a.size())
{
cnt[j] = a[j];
}
else
{
cnt[j] = 0;
}
}
bool is_answer = true;
for (int times = 1; times <= x; ++times)
{
for (int bit = 16; bit >= 0; --bit)
{
if ((i & (1 << bit)) == 0)
{
continue;
}
int need = 1;
bool found = false;
for (int j = bit; j >= 0; --j)
{
if (cnt[j] >= need)
{
found = true;
cnt[j] -= need;
break;
}
need = 2 * need;
}
if (found == false)
{
is_answer = false;
break;
}
}
if (is_answer == false)
{
break;
}
}
if (is_answer == true)
{
++ans;
}
}
return ans;
}
/*
1
3 3
5 2 1
1
3 2
2 1 2
*/
컴파일 시 표준 에러 (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... |