제출 #586436

#제출 시각아이디문제언어결과실행 시간메모리
586436Red_Inside휴가 (IOI14_holiday)C++17
7 / 100
5078 ms2104 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define forn(j, i, n) for(int i = j; i <= n; ++i) #define FOR(j, i, n) for(int i = j; i < n; ++i) #define nfor(j, i, n) for(int i = n; i >= j; --i) #define IOS ios_base::sync_with_stdio(false), cin.tie(), cout.tie(); #define all(v) v.begin(), v.end() const int maxn = 7e3+100; //#define int ll #define pii pair <int, int> int inf = 1e9; ll a[maxn]; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { forn(0, i, n-1) { a[i] = attraction[i]; } ll ans = 0; forn(0, mask, (1 << n) - 1) { int right = start; int left = start; ll s = 0; int cnt = 0; forn(0, i, n-1) { if(((mask>>i)&1)) { if(i >= start) right = max(right, i); else left = min(left, i); s += a[i]; cnt++; } } if(cnt + right-left + min(right-start,start-left) <= d) { ans = max(ans, s); } } return ans; } /* 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; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...