제출 #629396

#제출 시각아이디문제언어결과실행 시간메모리
629396MohamedFaresNebiliHoliday (IOI14_holiday)C++14
47 / 100
5064 ms2120 KiB
#include <bits/stdc++.h>

            using namespace std;

            using ll = long long;
            using ld = long double;

            #define ff first
            #define ss second
            #define pb push_back
            #define all(x) (x).begin(), (x).end()
            #define lb lower_bound

            ll solve(int N, int S, int D, int A[]) {
                if(S == N - 1) return 0;
                ll res = 0;
                for(int l = S; ~l && D; l--, D--) {
                    priority_queue<int, vector<int>, greater<int>> pq;
                    ll ans = 0, cur = 0;
                    for(int i = l; i < N; i++) {
                        pq.push(A[i]); cur += A[i];
                        while(pq.size() + i - l > D) {
                            if(pq.empty()) break;
                            cur -= pq.top(); pq.pop();
                        }
                        ans = max(ans, cur);
                    }
                    res = max(res, ans);
                }
                return res;
            }

            ll findMaxAttraction(int N, int start, int D, int attraction[]) {
                ll A = solve(N, start, D, attraction);
                reverse(attraction, attraction + N);
                start = N - start - 1;
                ll B = solve(N, start, D, attraction);
                return max(A, B);
            }

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

holiday.cpp: In function 'll solve(int, int, int, int*)':
holiday.cpp:22:49: 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]
   22 |                         while(pq.size() + i - l > 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...