제출 #391950

#제출 시각아이디문제언어결과실행 시간메모리
391950Aldas25휴가 (IOI14_holiday)C++14
23 / 100
18 ms2660 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(n) FOR(O, 1, (n)) #define f first #define s second #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<int> vi; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; priority_queue<ll, vl, greater<ll>> q; int rem = d; ll sum = 0; FOR(i, 0, n-1) { q.push(attraction[i]); sum += attraction[i]; while (q.size() > rem) { sum -= q.top(); q.pop(); } ans = max(ans, sum); rem--; if (rem <= 0) break; } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:27:25: 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]
   27 |         while (q.size() > rem) {
      |                ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...