제출 #1052821

#제출 시각아이디문제언어결과실행 시간메모리
1052821ProtonDecay314비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1066 ms227540 KiB
#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef short int si;
typedef vector<si> vsi;
typedef vector<vsi> vvsi;
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++)
#define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--)
#define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++)
#define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--)
#define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci
#define fi first
#define se second
#define pb push_back
#define INF(type) numeric_limits<type>::max()
#define NINF(type) numeric_limits<type>::min()
#define TCASES int t; cin >> t; while(t--)

ll count_tastiness(ll x, vll a) {
    ll MAX_X = 10'010ll;

    ll MAX_K = 60ll;

    set<ll> poss;
    poss.insert(0ll);

    // Extend a

    while((ll)a.size() < MAX_K) {
        a.pb(0ll);
    }

    // Remove excess

    for(ll i = 0ll; i < MAX_K; i++) {
        if(a[i] >= x + 2) {
            ll excess = a[i] - x;

            a[i + 1] += excess >> 1ll;

            a[i] -= (excess >> 1ll) << 1ll;
        }
    }

    ll s = 0ll;

    L(i, 0ll, MAX_K) {
        set<ll> to_union;

        s += a[i] << i;

        ll sdx = s / x;

        ll cur_p2 = 1ll << i;

        for(ll j : poss) {
            for(ll k = 1ll; j + cur_p2 * k <= sdx; k++) {
                to_union.insert(j + cur_p2 * k);
            }
        }

        for(ll j : to_union) poss.insert(j);
    }
    
    cout << "\n";

    // cout << dp[0][0] << "\n";

    // cout << flush;

	return poss.size();
}


컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'll count_tastiness(ll, vll)':
biscuits.cpp:34:8: warning: unused variable 'MAX_X' [-Wunused-variable]
   34 |     ll MAX_X = 10'010ll;
      |        ^~~~~
#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...