이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |