Submission #102936

#TimeUsernameProblemLanguageResultExecution timeMemory
102936CaroLindaHoliday (IOI14_holiday)C++14
23 / 100
46 ms6012 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 ; } long long int findMaxAttraction(int n, int start, int d,int a[]) { return sub_2 (n,start,d,a) * 1LL ; }

Compilation message (stderr)

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;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...