Submission #1178943

#TimeUsernameProblemLanguageResultExecution timeMemory
1178943browntoadPacking Biscuits (IOI20_biscuits)C++20
9 / 100
1096 ms328 KiB
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())

const ll maxn = 1e5+5;
const int bloc = 101;

long long count_tastiness(long long x, std::vector<long long> a) {
	ll mxval = 0;
	REP(i, SZ(a)){
		mxval += (1ll<<i) * a[i];
	}
	mxval /= x;
	ll cnt = 1;
	REP1(i, mxval){
		vector<ll> tmp = a;

		bool gg = false;
		ll cur = 0, curexp = 0;
		REP(j, SZ(tmp)){
			cur += tmp[j] * (1ll<<j);
			if (i&(1ll<<j)){
				curexp += (1ll<<j);
			}
			if (curexp * x > cur){
				gg = 1;
				break;
			}
		}
		
		if (!gg) {
			cnt++;
		}
	}
	return cnt;
	//return 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...