Submission #134608

#TimeUsernameProblemLanguageResultExecution timeMemory
134608mirbek01Holiday (IOI14_holiday)C++11
Compilation error
0 ms0 KiB
#include "holiday.h" #include "grader.cpp" #include <bits/stdc++.h> using namespace std; int d, start; long long ans; vector <int> vec, a; void calc(int l, int r, int opl, int opr){ if(l > r) return ; int md = (l + r) >> 1, opt = -1; long long ret = -1; for(int i = opl; i <= opr; i ++){ int lenA = (start - md), lenB = (i - start); int cnt = d - lenA - lenB - min(lenA, lenB); vector <int> vc; for(int k = md; k <= i; k ++) vc.push_back(vec[a[k]]); sort(vc.rbegin(), vc.rend()); long long now = 0; for(int k = 0; k < min( (int)vc.size(), cnt ); k ++) now += vc[k]; if(ret < now){ ret = now; opt = i; } } ans = max(ans, ret); calc(l, md - 1, opl, opt); calc(md + 1, r, opt, opr); } long long int findMaxAttraction(int n, int startS, int D, int ar[]) { d = D; start = startS; vec.push_back(-2e9); for(int i = 0; i < n; i ++){ vec.push_back(ar[i]); } sort(vec.begin(),vec.end()); vec.resize(unique(vec.begin(), vec.end()) - vec.begin()); for(int i = 0; i < n; i ++){ ar[i] = lower_bound(vec.begin(),vec.end(), ar[i])-vec.begin(); a.push_back(ar[i]); } calc(0, start, start, n); return ans; }

Compilation message (stderr)

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