Submission #1070966

#TimeUsernameProblemLanguageResultExecution timeMemory
1070966mariaclaraPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1133 ms1878328 KiB
#include "biscuits.h" #include<bits/stdc++.h> #pragma GCC optimize("O3, fast-math") using namespace std; typedef long long ll; typedef pair<int,int> pii; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define mk make_pair #define pb push_back #define fr first #define sc second ll count_tastiness(ll x, vector<ll> a) { int n = 60; while(sz(a) < 60) a.pb(0); for(int i = 0; i < n-1; i++) { if(a[i] < x) continue; a[i+1] += (a[i] - x)/2; a[i] = x + ((a[i] - x)%2); } a[n-1] = min(a[n-1], x); vector<ll> dp; dp.pb(0); ll to_add = 0; for(int i = 0; i < n; i++) { // (val + to_add)/2^i >= x // val >= (x << i) - to_add to_add += (a[i] << i); ll aux = (x<<i), val = to_add - aux; if((x << i) > 1e18) break; int m = sz(dp); for(int j = 0; j < m and dp[j] <= val; j++) { // dp[i][j] = guarda quantos números eu posso formar dp.pb(aux + dp[j]); } } return sz(dp); }

Compilation message (stderr)

biscuits.cpp:3:37: warning: bad option '-f fast-math' to pragma 'optimize' [-Wpragmas]
    3 | #pragma GCC optimize("O3, fast-math")
      |                                     ^
biscuits.cpp:15:38: warning: bad option '-f fast-math' to attribute 'optimize' [-Wattributes]
   15 | ll count_tastiness(ll x, vector<ll> a) {
      |                                      ^
#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...