제출 #250457

#제출 시각아이디문제언어결과실행 시간메모리
250457jwvg0425휴가 (IOI14_holiday)C++17
23 / 100
19 ms1664 KiB
#include"holiday.h" #include <queue> using namespace std; long long int fromZero(int n, int d, int attraction[]) { priority_queue<int, vector<int>, greater<int>> q; long long int now = 0; long long int ans = 0; for (int i = 0; i < n; i++) { // 0 -> i까지 간다고 했을 때 관광지 방문에 쓸 수 있는 날짜 int canVisit = d - i; now += attraction[i]; q.push(attraction[i]); while (q.size() > canVisit) { now -= q.top(); q.pop(); } ans = max(ans, now); } return ans; } long long int findMaxAttraction(int n, int start, int d, int attraction[]) { if (start == 0) return fromZero(n, d, attraction); // O(N^2) return 0; }

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

holiday.cpp: In function 'long long int fromZero(int, int, int*)':
holiday.cpp:22:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (q.size() > canVisit)
                ~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...