Submission #415557

#TimeUsernameProblemLanguageResultExecution timeMemory
415557Theo830Packing Biscuits (IOI20_biscuits)C++17
9 / 100
1094 ms332 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INF = 1e9+7; ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<ll> distr; ll rnd(ll a, ll b){return distr(rng)%(b-a+1)+a;} #include "biscuits.h" /* long long count_tastiness(long long x, std::vector<long long> a); int main() { int q; assert(scanf("%d", &q) == 1); vector<int> k(q); vector<long long> x(q); vector<vector<long long>> a(q); vector<long long> results(q); for (int t = 0; t < q; t++) { assert(scanf("%d%lld", &k[t], &x[t]) == 2); a[t] = vector<long long>(k[t]); for (int i = 0; i < k[t]; i++) { assert(scanf("%lld", &a[t][i]) == 1); } } fclose(stdin); for (int t = 0; t < q; t++) { results[t] = count_tastiness(x[t], a[t]); } for (int t = 0; t < q; t++) { printf("%lld\n", results[t]); } fclose(stdout); return 0; } */ ll A[200] = {0}; ll omades; ll solve(ll idx,ll posa){ if(idx == 200){ return 1; } ll em = posa + A[idx]; ll ans = solve(idx+1,em / 2); if(em >= omades){ em -= omades; ans += solve(idx+1,em / 2); } return ans; } long long count_tastiness(long long x, vector<long long> a){ memset(A,0,sizeof A); f(i,0,a.size()){ A[i] += a[i]; } omades = x; return solve(0,0); } /* 10 1 74 6025 1 10 8084 1 97 65719 1 58 12207 1 63 34166 1 43 27843 1 90 7392 1 68 14984 1 21 14498 1 78 42207 */

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:8:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define f(i,a,b) for(ll i = a;i < b;i++)
......
   73 |     f(i,0,a.size()){
      |       ~~~~~~~~~~~~               
biscuits.cpp:73:5: note: in expansion of macro 'f'
   73 |     f(i,0,a.size()){
      |     ^
#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...