Submission #1063751

#TimeUsernameProblemLanguageResultExecution timeMemory
1063751pawnedHoliday (IOI14_holiday)C++17
23 / 100
12 ms2988 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef long long ll; typedef pair<ll, ll> ii; typedef vector<ll> vi; #include "holiday.h" const int MAX = 100; // max attractions ll findMaxAttraction(int N, int start, int D, int attraction[]) { vi a; for (int i = 0; i < N; i++) { a.pb(attraction[i]); } vi counts(MAX + 1, 0); ll maximum = 0; for (int i = 0; i < N; i++) { // get from [0, i], inclusive ll total = 0; // get D - i largest ll rem = D - i; counts[a[i]]++; for (int j = MAX; j >= 0; j--) { if (rem >= counts[j]) { total += j * counts[j]; rem -= counts[j]; } else { total += j * rem; rem = 0; break; } } maximum = max(maximum, total); } return maximum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...