제출 #1045293

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10452932024-08-05 20:03:00ArthuroWich휴가 (IOI14_holiday)C++17
23 / 100
5049 ms5720 KiB
#include "holiday.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int findMaxAttraction(int32_t n, int32_t st, int32_t d, int32_t at[]) {
int ans = 0;
for (int l = st; l >= 0; l--) {
int co = 0;
multiset<int> s;
if (st-l > d) {
break;
}
for (int i = st; i >= l; i--) {
co += at[i];
s.insert(at[i]);
}
if (s.size() >= d-(st-l)) {
ans = max(ans, co);
}
for (int r = st+1; r < n; r++) {
if (st-l+r-st+min(r-st,st-l) > d) {
break;
}
int k = d-(st-l+r-st+min(r-st,st-l));
s.insert(at[r]);
co += at[r];
while(s.size() > k) {
co -= *s.begin();
s.erase(s.begin());
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

holiday.cpp: In function 'long long int findMaxAttraction(int32_t, int32_t, int32_t, int32_t*)':
holiday.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   17 |         if (s.size() >= d-(st-l)) {
      |             ~~~~~~~~~^~~~~~~~~~~
holiday.cpp:27:28: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   27 |             while(s.size() > k) {
      |                   ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...