제출 #385947

#제출 시각아이디문제언어결과실행 시간메모리
385947alireza_kaviani휴가 (IOI14_holiday)C++11
23 / 100
18 ms2284 KiB
#include <bits/stdc++.h> #include"holiday.h" using namespace std; typedef long long ll; const int MAXN = 8000; int dp[MAXN] , ans[MAXN][2][2]; priority_queue<int , vector<int> , greater<int>> pq; long long int findMaxAttraction(int n, int start, int d, int A[]) { if(start == 0){ ll ans = 0 , sum = 0; for(int i = 0 ; i < n ; i++){ sum += A[i]; pq.push(A[i]); while(pq.size() > d - i){ sum -= pq.top(); pq.pop(); } ans = max(ans , sum); } return ans; } for(int i = start ; i < n ; i++){ for(int j = n ; j >= 1 ; j--){ dp[j] = max(dp[j] , dp[j - 1] + A[i]); } for(int j = 0 ; j <= n ; j++){ ans[j + (i - start)][0][0] = max(ans[j + (i - start)][0][0] , dp[j]); ans[j + (i - start) * 2][0][1] = max(ans[j + (i - start) * 2][0][1] , dp[j]); } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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