제출 #1055543

#제출 시각아이디문제언어결과실행 시간메모리
1055543Trent비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1050 ms1051004 KiB
#include "biscuits.h"
#include "bits/stdc++.h"
using namespace std;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<ll> vll;

long long count_tastiness(long long x, std::vector<long long> a) {
	int k = 60;
	while(a.size() < k) a.push_back(0);
	vll vals = {a[0]};
	forR(i, k) {
		if(i + 1 < k) {
			vll nex = {};
			for(ll j : vals) {
				nex.push_back(j / 2 + a[i+1]);
				if(x <= j) nex.push_back((j-x) / 2 + a[i+1]);
			}
			vals.swap(nex);
		} else {
			ll tot = 0;
			for(ll j : vals) tot += j >= x ? 2 : 1;
			return tot;
		}
	}
}

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:17: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |  while(a.size() < k) a.push_back(0);
      |        ~~~~~~~~~^~~
biscuits.cpp:13:18: warning: control reaches end of non-void function [-Wreturn-type]
   13 |  vll vals = {a[0]};
      |                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...