제출 #586374

#제출 시각아이디문제언어결과실행 시간메모리
586374LastRonin휴가 (IOI14_holiday)C++14
0 / 100
5085 ms5332 KiB
#include"holiday.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll answ = 0; for(int i = 0; i < n; i++) { multiset<ll> a; ll sum = 0; for(int j = i; j < start; j++) a.insert(attraction[j]), sum += attraction[j]; for(int j = start; j < n; j++) { a.insert(attraction[j]); sum += attraction[j]; int enrg = d - min(2 * (j - start) + (start - i), (j - start) + 2 * (start - i)); if(enrg < 0)break; while(a.size() > enrg) { sum -= *a.begin(); a.erase(a.begin()); } answ = max(answ, sum); } } return answ; }

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

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