답안 #579946

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579946 2022-06-20T10:30:08 Z Vanilla 비스킷 담기 (IOI20_biscuits) C++17
0 / 100
1000 ms 852 KB
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
typedef long long int64;

bool check (int64 tg, int64 x, vector <int64> a) {
	vector <int64> b(x, 0);
	int64 n = a.size();
	int64 curr = tg;
	for (int64 i = n - 1; i >= 0; i--){
		for (int z = 0; z < 100; z++){
			int j = 0;
			while (j < x && a[i]) {
				if (b[j] + (1 << i) <= tg) {
					b[j]+=(1 << i);
					a[i]--;
				}
				j++;
			}
		}
	}
	for (int i = 0; i < x; i++){
		if (b[i] != tg) return 0;
	}
	return 1;
}

int64 count_tastiness(int64 x, vector<int64> a) {
	cout << "\n\n";
	int64 rs = 1;
	for (int i = 1; i <= 100000; i++){
		if (check(i, x, a)) rs++;
	}
	return rs;
}

Compilation message

biscuits.cpp: In function 'bool check(int64, int64, std::vector<long long int>)':
biscuits.cpp:9:8: warning: unused variable 'curr' [-Wunused-variable]
    9 |  int64 curr = tg;
      |        ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 938 ms 284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 941 ms 280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 938 ms 284 KB Output isn't correct
2 Halted 0 ms 0 KB -