Submission #260458

#TimeUsernameProblemLanguageResultExecution timeMemory
260458tbzardHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<int, pii> pipii; typedef pair<pii, int> piipi; typedef pair<pii, pii> piipii; #define mp make_pair #define fi first #define se second #define all(a) (a).begin(), (a).end() #define sz(a) (int)(a).size() #define eb emplace_back ll findMaxAttraction(int n, int start, int d, int attraction[]){ long long ans = 0; for(int i=1;i<(1<<n);i++){ vector<int> b; int l = 1e9, r = 0; for(int j=0;j<n;j++){ if((i>>j)&1){ b.eb(j); l = min(l, j); r = max(r, j); } } int cost = 0; if(l <= start && start <= r) cost = min(abs(start-l + (r-l)), abs(r-start + (r-l))); else if(r <= start) cost = start-l; else cost = r-start; if(cost > d) continue; vector<int> c; for(int i=0;i<sz(b);i++){ int val = attraction[b[i]]; c.eb(val); } sort(all(c)); reverse(all(c)); ll res = 0; int cnt = 0; for(int i=0;i<sz(c);i++){ if(cnt < d-cost){ cnt++; res += c[i]; } } ans = max(ans, res); } return ans; } int main(){ int n, start, d; cin >> n >> start >> d; int a[n+5]; for(int i=0;i<n;i++){ cin >> a[i]; } printf("%lld\n", findMaxAttraction(n, start, d, a)); }

Compilation message (stderr)

/tmp/ccLmo9ix.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccFG9G4q.o:holiday.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status