제출 #586378

#제출 시각아이디문제언어결과실행 시간메모리
586378LastRonin휴가 (IOI14_holiday)C++14
컴파일 에러
0 ms0 KiB
#include"holiday.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll answ = 0; for(int i = 0; i < n; i++) { multiset<ll> a; ll sum = 0; for(int j = i; j < start; j++) a.insert(attraction[j]), sum += attraction[j]; for(int j = start; j < n; j++) { a.insert(attraction[j]); sum += attraction[j]; ll enrg = d - min(2 * (j - start) + (start - i), (j - start) + 2 * (start - i)); if(enrg < 0)break; auto it = prev(a.end()); ll cum = 0; enrg = min(enrg, (ll)a.size()); while(enrg--) { cum += *it; it = prev(it); } answ = max(answ, cum); } } return answ; } int main() { int n, start, d; int attraction[100000]; int i, n_s; n_s = scanf("%d %d %d", &n, &start, &d); for (i = 0 ; i < n; ++i) { n_s = scanf("%d", &attraction[i]); } printf("%lld\n", findMaxAttraction(n, start, d, attraction)); return 0; } /* 5 2 7 10 2 20 30 1 */

컴파일 시 표준 에러 (stderr) 메시지

holiday.cpp: In function 'int main()':
holiday.cpp:34:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
   34 |     int i, n_s;
      |            ^~~
/usr/bin/ld: /tmp/ccQ63eON.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccp19kDM.o:holiday.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status