Submission #1019725

#TimeUsernameProblemLanguageResultExecution timeMemory
1019725NValchanovHoliday (IOI14_holiday)C++17
0 / 100
23 ms6220 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; typedef long long ll; ll start0(int n, int d, int a[]) { ll ans = 0; set < int > s; ll sum = 0; for(int i = 0; i < n; i++) { s.insert(a[i]); sum += (ll)a[i]; int ost = d - i - 1; while(s.size() > ost) { auto it = s.begin(); sum -= (ll)*it; s.erase(it); } ans = max(ans, sum); } return ans; } ll slow(int n, int start, int d, int a[]) { return -1; } long long int findMaxAttraction(int n, int start, int d, int a[]) { if(start == 0) return start0(n, d, a); else slow(n, start, d, a); }

Compilation message (stderr)

holiday.cpp: In function 'll start0(int, int, int*)':
holiday.cpp:23:24: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         while(s.size() > ost)
      |               ~~~~~~~~~^~~~~
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:48:13: warning: control reaches end of non-void function [-Wreturn-type]
   48 |         slow(n, start, d, a);
      |         ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...