# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50767 | Just_Solve_The_Problem | Holiday (IOI14_holiday) | C++11 | 5018 ms | 924 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include"holiday.h"
using namespace std;
#define pb push_back
#define sz(s) (int)s.size()
#define ll long long
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
if (start == 0) {
} else {
ll ans = 0;
for (int mask = 1; mask < (1 << n); mask++) {
vector < int > v;
for (int i = 0; i < n; i++) {
if (mask & (1 << i)) {
v.pb(i);
}
}
ll res = 0;
ll time = sz(v);
if (start > v.back() || start < v[0]) {
if (start > v.back()) {
time += abs(start - v.back());
} else {
time += abs(start - v[0]);
}
} else {
time += min(abs(start - v[0]), abs(start - v.back())) + v.back() - v[0];
}
for (int to : v) {
res += attraction[to];
}
if (time <= d) {
ans = max(ans, res);
}
}
return ans;
}
}
Compilation message (stderr)
# | 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... |