Submission #1017446

#TimeUsernameProblemLanguageResultExecution timeMemory
1017446Ice_manHoliday (IOI14_holiday)C++14
47 / 100
5073 ms3044 KiB
/** ____ ____ ____ __________________ ____ ____ ____ ||I || ||c || ||e || || || ||M || ||a || ||n || ||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__|| |/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\| */ #include <iostream> #include <chrono> #include <vector> #include <algorithm> #include <assert.h> #include <queue> #include "holiday.h" #define maxn 1005 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef pair <ll, ll> pll; typedef pair <int, ll> pil; typedef pair <ll, int> pli; typedef long double ld; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } long long int findMaxAttraction(int n , int start , int d , int a[]) { ll ans = 0; ll curr = 0; for(int l = start; l > -1; l--) { curr = 0; priority_queue <ll , vector <ll> , greater <ll> > q; for(int i = start - 1; i >= l; i--) { q.push(a[i]); curr += a[i]; } for(int r = start; r < n; r++) { int pom = (start - l) + (r - start) + min((start - l) , (r - start)); if(pom >= d) continue; pom = d - pom; q.push(a[r]); curr += a[r]; while(q.size() > pom) { curr -= q.top(); q.pop(); } ans = max(ans , curr); } } return ans; } /**int main() { #ifdef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); ///startT = std::chrono::high_resolution_clock::now(); return 0; } */

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:80:28: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   80 |             while(q.size() > pom)
      |                   ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...