Submission #586567

#TimeUsernameProblemLanguageResultExecution timeMemory
586567SeDunionHoliday (IOI14_holiday)C++17
23 / 100
23 ms1108 KiB
#include"holiday.h" #include<algorithm> #include<iostream> #include<vector> using namespace std; using ll = long long; int cnt[111]; ll findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int i = 0 ; i < n ; ++ i) { cnt[attraction[i]]++; int x = d - i; ll cur = 0; for (int y = 100 ; y >= 0 ; -- y) { int q = min(cnt[y], x); x -= q; cur += q * y; } ans = max(ans, cur); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...