제출 #950520

#제출 시각아이디문제언어결과실행 시간메모리
950520hengliao휴가 (IOI14_holiday)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define vll vector<ll> #define pll pair<ll, ll> typedef long long ll; ll findMaxAttraction(ll n, ll s, ll d, ll a[]){ if(s==0){ set<ll> st; ll cur=0; ll ans=0; ll siz=0; for(ll i=0;i<n;i++){ if(d<=0) break; st.insert(a[i]); cur+=a[i]; siz++; while(siz>d){ cur-=*st.begin(); st.erase(st.begin()); siz--; } ans=max(ans, cur); d--; } cout<<ans<<'\n'; } } /*int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }*/

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

holiday.cpp: In function 'll findMaxAttraction(ll, ll, ll, ll*)':
holiday.cpp:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
   32 | }
      | ^
/usr/bin/ld: /tmp/ccg4AcPc.o: in function `main':
grader.cpp:(.text.startup+0xaf): undefined reference to `findMaxAttraction(int, int, int, int*)'
collect2: error: ld returned 1 exit status