Submission #1042500

#TimeUsernameProblemLanguageResultExecution timeMemory
1042500kimnhatdev1106Holiday (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e5 + 5; int n, s, d, a[N], ans, mp[N]; void ql(int pos, int sum, int d){ if(d == 0){ ans = max(ans, sum); return; } if(mp[pos] == 0){ mp[pos] = 1; ql(pos, sum + a[pos], d - 1); mp[pos] = 0; } if(pos > 0){ ql(pos - 1, sum, d - 1); } if(pos + 1 < n){ ql(pos + 1, sum, d - 1); } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> s >> d; for(int i = 0; i < n; i++){ cin >> a[i]; } ql(s, 0, d); cout << ans; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbI9M6i.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cckZxgVi.o:holiday.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbI9M6i.o: in function `main':
grader.cpp:(.text.startup+0xaf): undefined reference to `findMaxAttraction(int, int, int, int*)'
collect2: error: ld returned 1 exit status