제출 #1239954

#제출 시각아이디문제언어결과실행 시간메모리
1239954franuch비스킷 담기 (IOI20_biscuits)C++20
9 / 100
1096 ms836 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define vc vector #define st first #define nd second #define all(a) a.begin(), a.end() #define sz(a) (ll)a.size() #define pub push_back #define pob pop_back bool cont(ll mask, ll i) { return (mask & (1ll << i)) != 0; } bool check(ll x, ll y, vc<ll> &a) { ll n = sz(a); ll sy = 0, sa = 0; for (ll i = 0; i < n; i++) { if (cont(y, i)) sy += x * (1ll << i); sa += a[i] * (1ll << i); if (sy > sa) return false; } return true; } ll count_tastiness(ll x, vc<ll> a) { ll n = sz(a); ll ret = 0; ll sum = 0; for (ll i = 0; i < n; i++) sum += a[i] * (1ll << i); for (ll y = 0; x * y <= sum; y++) { if (check(x, y, a)) ret++; } return ret; }
#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...