Submission #586565

#TimeUsernameProblemLanguageResultExecution timeMemory
586565SeDunionHoliday (IOI14_holiday)C++17
0 / 100
23 ms1196 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]]++; } for (int i = 0 ; i < n ; ++ 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...