제출 #422671

#제출 시각아이디문제언어결과실행 시간메모리
422671Andyvanh1휴가 (IOI14_holiday)C++14
23 / 100
44 ms6212 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; #define vt vector #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,x) for(int (i) = 0; (i) < (x); (i)++ ) typedef long long ll; typedef long double ld; typedef vt<int> vi; typedef pair<int,int> pii; long long int findMaxAttraction(int n, int start, int d,int attraction[]){ ll Max = 0; if(d>2*n-1)d = 2*n-1; multiset<int> st; ll cur = 0; int a = d/2+1; int b = (d+1)/2; for(int i = 0; i < a; i++){ st.insert(attraction[i]); cur+=attraction[i]; } while(st.size()!=b){ cur-=*st.begin(); st.erase(st.begin()); } Max = cur; while(a < n&&b!=0){ b--; cur += attraction[a]; st.insert(attraction[a]); cur -= *st.begin(); st.erase(st.begin()); cur -= *st.begin(); st.erase(st.begin()); Max = max(Max, cur); a++; } return Max; }

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

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