Submission #918385

#TimeUsernameProblemLanguageResultExecution timeMemory
918385contest_altHoliday (IOI14_holiday)C++17
7 / 100
5034 ms1628 KiB
#include "holiday.h" using ll = long long; #include <algorithm> #include <vector> namespace Solver { const int MAXN = 1e5; int v[MAXN]; ll query( int st, int dr, int x ) { std::vector<int> seg; for( int i = st ; i <= dr ; i++ ) seg.push_back( v[i] ); std::sort( seg.begin(), seg.end(), std::greater<int>() ); x = std::min( (int)seg.size(), x ); ll ret = 0; for( int i = 0 ; i < x ; i++ ) ret += seg[i]; return ret; } ll patratic( int n, int start, int d, int w[] ) { for( int i = 0 ; i < n ; i++ ) v[i] = w[i]; ll ret = 0; for( int st = 0 ; st <= start ; st++ ) for( int dr = start ; dr < n ; dr++ ){ int nr = d - (dr - st + std::min( start - st, dr - start )); if( nr <= 0 ) continue; ll cand = query( st, dr, nr ); ret = cand > ret ? cand : ret; } return ret; } ll main( int n, int start, int d, int v[] ) { return 0; } } long long int findMaxAttraction( int n, int start, int d, int attraction[] ) { if( n <= 3000 ) return Solver::patratic( n, start, d, attraction ); return Solver::main( n, start, d, attraction ); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...