제출 #442350

#제출 시각아이디문제언어결과실행 시간메모리
442350DmitryGrigorev비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1081 ms332 KiB
#include <bits/stdc++.h> #define ll long long #define db long double #define x first #define y second #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() using namespace std; const int mod = 1000000007; void add(int& a, int b) { a += b; if (a >= mod) a -= mod; if (a < 0) a += mod; } int mult(int a, int b) { return a * (ll)b % mod; } int bp(int a, int b) { int res = 1; while (b > 0) { if (b & 1) res = mult(res, a); a = mult(a, a); b >>= 1; } return res; } ll count_tastiness(ll x, vector<ll> a) { int k = a.size(); vector<ll> bounds; for (int i = 0; i < 20; ++i) { ll sum = 0; for (int j = 0; j < min(k, i+1); ++j) { sum += (1LL<<j) * a[j]; } bounds.pb(sum / x); } int ans = 0; for (int j = 0; j <= 100000; ++j) { bool can = true; for (int e = 0; e < 20; ++e) { if (j%(1<<(e+1)) > bounds[e]) { //if (j == 1) cout << (j+1)%(1<<(e+1)) << " " << bounds[e] << endl; can = false; } } ans += can; } return ans; } #ifdef LOCAL int main(){ freopen("A_input.txt", "r", stdin); //freopen("A_output.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); int k; ll x; cin >> k >> x; vector<ll> v(k); for (auto &x : v) cin >> x; cout << count_tastiness(x, v) << endl; } #endif
#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...