Submission #298965

#TimeUsernameProblemLanguageResultExecution timeMemory
298965abyyskitHoliday (IOI14_holiday)C++14
47 / 100
5064 ms6444 KiB
#include"holiday.h" #include<bits/stdc++.h> using namespace std; #define FOR(i, x, y) for(int i = x; i < y; ++i) long long Rightsolve(int d, vector<int> & A, int start){ if (d <= 0){ return 0; } multiset<int> s; long long ans = 0; long long mans = 0; FOR(i, start, A.size()){ s.insert(A[i]); ans += (long long)A[i]; int travel = i - start; while(s.size() != 0 && travel + s.size() > d){ ans -= *s.begin(); s.erase(s.begin()); } mans = max(ans, mans); } return mans; } long long int findMaxAttraction(int n, int start, int d, int attraction[]) { vector<int> T(n); vector<int> R(n); FOR(i, 0, n){ T[i] = attraction[i]; R[n - i -1] = attraction[i]; } long long ans = 0; FOR(i, 0, start + 1){ ans = max(ans, Rightsolve(d- (start - i), T, i)); } if (start != 0){ FOR(i, start, n){ ans = max(ans, Rightsolve(d - (i - start), R, n - i - 1)); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int Rightsolve(int, std::vector<int>&, int)':
holiday.cpp:4:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define FOR(i, x, y) for(int i = x; i < y; ++i)
......
   13 |  FOR(i, start, A.size()){
      |      ~~~~~~~~~~~~~~~~~~                
holiday.cpp:13:2: note: in expansion of macro 'FOR'
   13 |  FOR(i, start, A.size()){
      |  ^~~
holiday.cpp:17:44: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |   while(s.size() != 0 && travel + s.size() > d){
      |                          ~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...