제출 #965176

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9651762024-04-18 07:59:27weakweakweakGarden (JOI23_garden)C++17
30 / 100
3041 ms1372 KiB
//
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
#pragma GCC optimize("Ofast")
#define fs first
#define sc second
int n, m, d;
struct special_set {
set<int> sts;
multiset<int> mst;
int cnt[10010] = {0};
int query () {
if (mst.empty ()) return 1;
int z = *mst.rbegin();
z = max(z, *sts.begin() + d - *sts.rbegin());
return d - z + 1;
}
void add (int x) {
if (x >= d) return;
cnt[x]++;
if (cnt[x] != 1) return;
auto zz = sts.insert(x);
auto it = zz.first;
if (next(it) != sts.end() and it != sts.begin()) mst.erase(mst.find(*next(it) - *prev(it)));
if (next(it) != sts.end()) mst.insert(*next(it) - x);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...