# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
860578 | 2023-10-13T10:59:20 Z | mychecksedad | Packing Biscuits (IOI20_biscuits) | C++17 | 1000 ms | 13004 KB |
#include<biscuits.h> #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 22; ll count_tastiness(ll x, vector<ll> a){ for(int i = 0; i < 60; ++i) a.pb(0); int n = a.size(); for(int i = 0; i < n - 1; ++i){ if(a[i] >= x){ a[i + 1] += (a[i]-x)>>1; a[i] = x; } } ll ans = 1; vector<array<ll, 2>> p; p.pb({0ll, 1ll}); for(int i = 0; i < n; ++i){ vector<array<ll, 2>> pp, pp2; for(auto z: p){ ll y = z[0]; if(pp.empty() || pp.back()[0] != ((y+a[i])>>1)){ pp.pb({(y+a[i])>>1, z[1]}); }else if(pp.back()[0] == ((y+a[i])>>1)){ pp.back()[1] += z[1]; } if((y+a[i]-x) >= 0){ if(pp2.empty() || pp2.back()[0] != ((y+a[i]-x)>>1)){ pp2.pb({(y+a[i]-x)>>1, z[1]}); }else if(pp2.back()[0] == ((y+a[i]-x)>>1)){ pp2.back()[1] += z[1]; } ans += z[1]; // pp[(y+a[i]-x)>>1] += z.second; // ans += z.second; } } p.clear(); int po = 0; for(int j = 0; j < pp.size(); ++j){ while(po < pp2.size() && pp2[po][0] < pp[j][0]){ p.pb(pp2[po]); ++po; } p.pb(pp[j]); if(po < pp2.size() && pp2[po][0] == p.back()[0]){ p.back()[1] += pp2[po][1]; ++po; } } // for(auto f: p) cout << f << ' '; // en; // cout << ans << '\n'; } // cout << s << ' '; // cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 856 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1029 ms | 13004 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |