Submission #975067

#TimeUsernameProblemLanguageResultExecution timeMemory
975067LucaIliePacking Biscuits (IOI20_biscuits)C++17
0 / 100
2 ms360 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; const int k = 4; long long x; long long biscuits[k]; __int128 sum[k]; vector<long long> sol, newSol; long long count_tastiness( long long X, vector <long long> a ) { long long s; x = X; a.resize( k ); s = 0; for ( int b = 0; b < k; b++ ) { a[b] += s; if ( a[b] > x ) { s = a[b] - x; a[b] = x + s % 2; s /= 2; } else s = 0; biscuits[b] = a[b]; } sum[0] = biscuits[0]; for ( int b = 1; b < k; b++ ) sum[b] = sum[b - 1] + ((__int128)biscuits[b] << b); sol.clear(); sol.push_back( 0 ); for ( int b = 0; b < k; b++ ) { vector<long long> newSol; for ( int y: sol ) { if ( y + (1LL << b) <= sum[b] / x ) newSol.push_back( y + (1LL << b) ); else break; } printf( "\n" ); for ( int y: newSol ) sol.push_back( y ); } return sol.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...