제출 #586382

#제출 시각아이디문제언어결과실행 시간메모리
586382LastRoninHoliday (IOI14_holiday)C++14
7 / 100
5083 ms5288 KiB
#include"holiday.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll answ = 0; for(int i = 0; i <= start; i++) { multiset<ll> a; ll sum = 0; for(int j = i; j < start; j++) a.insert(attraction[j]), sum += attraction[j]; for(int j = start; j < n; j++) { a.insert(attraction[j]); sum += attraction[j]; ll enrg = d - min(2 * (j - start) + (start - i), (j - start) + 2 * (start - i)); if(enrg < 0)break; auto it = prev(a.end()); ll cum = 0; enrg = min(enrg, (ll)a.size()); while(enrg--) { cum += *it; it = prev(it); } answ = max(answ, cum); } } return answ; } /* int main() { int n, start, d; int attraction[100000]; int i, n_s; n_s = scanf("%d %d %d", &n, &start, &d); for (i = 0 ; i < n; ++i) { n_s = scanf("%d", &attraction[i]); } printf("%lld\n", findMaxAttraction(n, start, d, attraction)); return 0; } /* 5 2 7 10 2 20 30 1 */

컴파일 시 표준 에러 (stderr) 메시지

holiday.cpp:42:1: warning: "/*" within comment [-Wcomment]
   42 | /*
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...