제출 #781752

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7817522023-07-13 10:35:16joelgun14Global Warming (CEOI18_glo)C++17
15 / 100
97 ms3236 KiB
#include <bits/stdc++.h>
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define lb lower_bound
using namespace std;
int main() {
int n, x;
cin >> n >> x;
int t[n + 1];
for(int i = 1; i <= n; ++i) {
cin >> t[i];
}
// find prefix lis/suffix lis, nanti cari yg max di mana
// suffix lis -> lds dr belakang
// prefix lis -> lis dr depan
int pref[n + 1], suff[n + 1];
vector<int> lis, lds;
for(int i = 1; i <= n; ++i) {
if(lower_bound(lis.begin(), lis.end(), t[i]) != lis.end()) {
lis[lower_bound(lis.begin(), lis.end(), t[i]) - lis.begin()] = t[i];
}
else {
lis.push_back(t[i]);
}
pref[i] = lb(lis.begin(), lis.end(), t[i]) - lis.begin() + 1;
}
for(int i = n; i >= 1; --i) {
if(lower_bound(lds.begin(), lds.end(), -t[i]) != lds.end()) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...