Submission #376571

# Submission time Handle Problem Language Result Execution time Memory
376571 2021-03-11T17:31:17 Z Jarif_Rahman Packing Biscuits (IOI20_biscuits) C++17
9 / 100
1000 ms 1051224 KB
#include "biscuits.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int kk = 62;
ll count_tastiness(ll x, vector<ll> aa){
    vector<ll> a(kk);
    int k = aa.size();
    for(int i = 0; i < k; i++) a[i] = aa[i];
    ll ans = 0;
    vector<ll> s(kk, 0);
    ll md = 0;
    for(int i = 0; i < kk; i++){
        if(i != 0) s[i] = s[i-1];
        s[i]+=(a[i]*(1LL<<i))/x;
        md+=(a[i]*(1LL<<i))%x;
        if(md >= x) s[i]+=md/x, md%=x;
    }
    vector<ll> v;
    v.pb({0});
    for(int i = 0; i < kk; i++){
        ll mx = s[i], p = 1;
        p<<=i;
        mx-=p;
        int in = upper_bound(v.begin(), v.end(), mx) - v.begin();
        for(int j = 0; j < in; j++) v.pb(v[j]+p);
    }
    return v.size();
}

Compilation message

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:14:8: warning: unused variable 'ans' [-Wunused-variable]
   14 |     ll ans = 0;
      |        ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1508 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 1124 KB Output is correct
5 Correct 1 ms 548 KB Output is correct
6 Correct 5 ms 2176 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 5 ms 2176 KB Output is correct
9 Correct 1 ms 520 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 2 ms 748 KB Output is correct
13 Correct 1 ms 492 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1508 KB Output is correct
2 Execution timed out 1169 ms 1019600 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1126 ms 1051224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 876 ms 4092 KB Output is correct
2 Execution timed out 1081 ms 5312 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1508 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 1124 KB Output is correct
5 Correct 1 ms 548 KB Output is correct
6 Correct 5 ms 2176 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 5 ms 2176 KB Output is correct
9 Correct 1 ms 520 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 2 ms 748 KB Output is correct
13 Correct 1 ms 492 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 2 ms 1508 KB Output is correct
16 Execution timed out 1169 ms 1019600 KB Time limit exceeded
17 Halted 0 ms 0 KB -