Submission #102935

#TimeUsernameProblemLanguageResultExecution timeMemory
102935CaroLindaHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "holiday.h" #define lp(i,a,b) for(int i=a;i<b;i ++) #define MAXN 100005 #define pb push_back #define pii pair<int,int> #define ss second #define ff first #define lli long long int using namespace std; multiset<int> m ; int resp ; void tira() { resp -= *m.begin() ; m.erase(m.begin()) ; } int sub_2 (int n, int start, int d,int a[]) { resp = 0 ; m.clear() ; int best = -1 ; lp(i, 0 ,min( d , n )) { m.insert(a[i]) ; resp += a[i] ; int k = m.size() ; if( k - 1 > d - i ) tira() ; if(k > d-i) tira() ; best = max( best , resp ) ; } return best ; } int findMaxAttraction(int n, int start, int d,int a[]) { return sub_2 (n,start,d,a) ; }

Compilation message (stderr)

holiday.cpp: In function 'int findMaxAttraction(int, int, int, int*)':
holiday.cpp:50:5: error: ambiguating new declaration of 'int findMaxAttraction(int, int, int, int*)'
 int findMaxAttraction(int n, int start, int d,int a[])
     ^~~~~~~~~~~~~~~~~
In file included from holiday.cpp:2:0:
holiday.h:5:15: note: old declaration 'long long int findMaxAttraction(int, int, int, int*)'
 long long int findMaxAttraction(int n, int start, int d, int attraction[]) ;
               ^~~~~~~~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:7:12: warning: variable 'n_s' set but not used [-Wunused-but-set-variable]
     int i, n_s;
            ^~~