제출 #1042981

#제출 시각아이디문제언어결과실행 시간메모리
1042981ALeonidou휴가 (IOI14_holiday)C++17
7 / 100
5063 ms3024 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define pb push_back #define endl "\n" #define sz(x) (ll)x.size() typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } vi val; ll n; long long int findMaxAttraction(int N, int start, int D, int attraction[]) { ll s = start; n = N; ll d = D; for (ll i= 0; i<n; i++){ val.pb(attraction[i]); } ll ans= 0; ll n2 = (1 << n); for (ll i=0; i<n2; i++){ ll l = s, r = s, cnt = 0, cur_val = 0; for (ll j = 0; j<n; j++){ if (i & (1 << j)){ l = min(l, j); r = max(r, j); cnt++; cur_val += val[j]; } } ll x = d - cnt; ll e = min(r-s, s-l) * 2 + max(r-s, s-l); if (e <= x){ ans = max(ans, cur_val); } } 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...