제출 #284736

#제출 시각아이디문제언어결과실행 시간메모리
284736Ozy휴가 (IOI14_holiday)C++17
23 / 100
2174 ms4652 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a);i <= (b); i++) #define debug(a) cerr << #a << " = " << a << endl; priority_queue<int> cola; long long int sum,MAX; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { int a; MAX = 0; sum = 0; if (start == 0) { rep(i,0,n-1) { a = d - i; debug(a); if (a > 0) { while (!cola.empty() && cola.size() > a) { sum += cola.top(); cola.pop(); } if (cola.size() == a) { if (-(cola.top()) < attraction[i]) { cerr << "reemplace "; debug(cola.top()); cerr << "meti "; debug(attraction[i]); sum += cola.top(); cola.pop(); cola.push(-attraction[i]); sum += attraction[i]; } } else { cola.push(-attraction[i]); sum += attraction[i]; cerr << "Meti "; debug(a); } if (sum > MAX) MAX = sum; } else return MAX; cerr << "\n"; } return MAX; } return 0; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:22:53: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |                 while (!cola.empty() && cola.size() > a) {
      |                                         ~~~~~~~~~~~~^~~
holiday.cpp:27:33: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |                 if (cola.size() == a) {
      |                     ~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...