Submission #50768

#TimeUsernameProblemLanguageResultExecution timeMemory
50768Just_Solve_The_ProblemHoliday (IOI14_holiday)C++11
0 / 100
376 ms724 KiB
#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 (n <= 20) {
    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;
  }
  if (start == 0) {

  } else {

  }
}

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...