제출 #413901

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4139012021-05-29 16:54:08flashmt밀림 점프 (APIO21_jumps)C++17
4 / 100
1419 ms55900 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
const int LG = 18;
int n, l[N][LG], r[N][LG], high[N][LG];
vector<int> h;
void initEdges()
{
vector<pair<int, int>> sortedH;
for (int i = 0; i < n; i++)
sortedH.push_back({h[i], i});
sort(sortedH.begin(), sortedH.end(), greater<pair<int, int>>());
set<int> s;
s.insert(-1);
s.insert(n);
memset(l, -1, sizeof l);
memset(r, -1, sizeof r);
memset(high, -1, sizeof high);
for (auto [_, i] : sortedH)
{
auto it = s.lower_bound(i);
r[i][0] = *it;
l[i][0] = *(--it);
if (l[i][0] < 0) high[i][0] = r[i][0];
else if (r[i][0] < 0) high[i][0] = l[i][0];
else if (h[l[i][0]] > h[r[i][0]]) high[i][0] = l[i][0];
else high[i][0] = r[i][0];
s.insert(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...