Submission #306052

# Submission time Handle Problem Language Result Execution time Memory
306052 2020-09-24T11:50:30 Z lolicon Packing Biscuits (IOI20_biscuits) C++14
9 / 100
1000 ms 384 KB
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;

#define int long long

#define SZ(x) ((int)(x).size())
#define all(x) begin(x), end(x)
 

bool chk(int v, int x, vector<int> cnt) {
	for(int i = 0; i < x; i++) {
		int val = v;
		for(int j = SZ(cnt) - 1; j >= 0; j--) {
			int need = min(cnt[j], val / (1LL << j));
			cnt[j] -= need; val -= (1ll << j) * need; 
		}
		if(val) return false;
	}
	return true;
}

int count_tastiness(int x, vector<int> a) {
	int k = a.size();
	int sum = 0;
	for(int i = 0; i < k; i++) {
		sum += (1LL << i) * a[i];
	}	 
	int ret = 1;
	for(int i = 1; i * x <= sum; i++) {
		if(chk(i, x, a)) ret++; 
	}
	return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 18 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 75 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 76 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 9 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 239 ms 376 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 200 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 256 KB Output is correct
2 Execution timed out 1065 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 18 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 75 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 76 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 9 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 239 ms 376 KB Output is correct
13 Correct 205 ms 256 KB Output is correct
14 Correct 200 ms 384 KB Output is correct
15 Correct 13 ms 256 KB Output is correct
16 Execution timed out 1065 ms 256 KB Time limit exceeded
17 Halted 0 ms 0 KB -