제출 #348800

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3488002021-01-15 18:41:10dennisstar휴가 (IOI14_holiday)C++17
100 / 100
1780 ms7020 KiB
#include <bits/stdc++.h>
#include "holiday.h"
#define em emplace
using namespace std;
using ll = long long;
const int MX = 1e5 + 5;
int N, S, D;
ll H[MX], A;
struct myset {
multiset<ll> S1, S2;
ll V; int s, e;
void init() {
s=0; e=-1; V=0;
S1.clear(); S2.clear();
}
void ins(int i) {
if (S1.empty()||*S1.rbegin()<H[i]) S2.em(H[i]), V+=H[i];
else S1.em(H[i]);
}
void er(int i) {
if (S1.find(H[i])!=S1.end()) S1.erase(S1.find(H[i]));
else if (S2.find(H[i])!=S2.end()) S2.erase(S2.find(H[i])), V-=H[i];
else assert(false);
}
void res(int ss, int ee) {
for (int i=s-1; i>=ss; i--) ins(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

holiday.cpp: In member function 'll myset::get(int)':
holiday.cpp:38:19: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |   while (S2.size()<c&&S1.size()>0) V+=*S1.rbegin(), S2.em(*S1.rbegin()), S1.erase(--S1.end());
      |          ~~~~~~~~~^~
holiday.cpp:39:19: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |   while (S2.size()>c) V-=*S2.begin(), S1.em(*S2.begin()), S2.erase(S2.begin());
      |          ~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...