Submission #617643

# Submission time Handle Problem Language Result Execution time Memory
617643 2022-08-01T12:35:08 Z DanShaders Packing Biscuits (IOI20_biscuits) C++17
12 / 100
1000 ms 340 KB
//Dgrader.cpp
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
using ll = long long;
using ld = long double;
#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())

ll count_tastiness(ll x, vector<ll> k) {
	if (x == 1) {
		ll a = 1, b = 1, c = 0;
		for (ll q : k) {
			a += q;
			if (a % 2) {
				c += b;
			}
			a /= 2;
			b *= 2;
			if (a == 0) {
				a = 1;
				b = c;
				c = 0;
			}
		}
		return a * b + c;
	} else {
		ll total = 0;
		for (int i = 0; i < sz(k); ++i) {
			total += k[i] << i;
		}
		total /= x;

		ll ans = 0;
		auto ck = k;
		for (ll req = 0; req <= total; ++req) {
			ck = k;
			bool possible = true;
			for (int i = 0; i < x; ++i) {
				ll curr = req;
				for (int j = sz(ck); j--; ) {
					ll cnt = min(ck[j], curr >> j);
					curr -= cnt << j;
					ck[j] -= cnt;
				}
				if (curr) {
					possible = false;
					break;
				}
			}
			ans += possible;
		}
		return ans;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 1091 ms 212 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Execution timed out 1091 ms 212 KB Time limit exceeded
3 Halted 0 ms 0 KB -