제출 #996309

#제출 시각아이디문제언어결과실행 시간메모리
996309Rifal비스킷 담기 (IOI20_biscuits)C++14
0 / 100
806 ms432 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x, std::vector<long long> a) {
	long long ans = 0;
	int siz = a.size();
	for(long long i = 0; i <= 100000; i++) {
		int cur[siz] = {};
		for(int j = 0; j < a.size(); j++) cur[j] = a[j];
		bool ok = true;
		for(long long j = 0; j < 20; j++) {
			if((i&(1ll<<j)) > 0) {
				if(j >= siz) {
					ok = false; break;
				}
				if(cur[j] >= x) {
					cur[j] -= x;
				}
				else {
					ok = false; break;
				}
			}
			if(!ok) break;
			if(j+1 < siz && cur[j] != 0) cur[j+1] += cur[j]/2;
		}
		if(ok) ans++;
	}
	return ans;
}

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for(int j = 0; j < a.size(); j++) cur[j] = a[j];
      |                  ~~^~~~~~~~~~
#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...