제출 #586573

#제출 시각아이디문제언어결과실행 시간메모리
586573SeDunion휴가 (IOI14_holiday)C++17
24 / 100
5068 ms5348 KiB
#include"holiday.h" #include<algorithm> #include<iostream> #include<vector> #include<set> using namespace std; using ll = long long; const int N = 222; const int D = 2*N + N/2; ll sum = 0; multiset<ll>st; ll findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int _ = 0 ; _ < 2 ; ++ _) { for (int i = start ; i < n ; ++ i) { int x = d - (i - start); st.clear(); sum = 0; for (int j = i ; j >= 0 ; -- j) { sum += attraction[j]; st.insert(attraction[j]); int y = x - (i - j); if (y < 0) break; while ((int)st.size() > y) { sum -= *st.begin(); st.erase(st.begin()); } ans = max(ans, sum); } } reverse(attraction, attraction + n); start = n - start - 1; } 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...