Submission #1047942

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10479422024-08-07 17:59:26TAhmed33Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++98
64 / 100
600 ms262144 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int const mxN = 1e6+5;
int n, pw;
vector<int> seg [4*mxN];
int ans[4*mxN], a[4*mxN];
void build ( int node, int l, int r) {
if(l==r-1) { seg[node].push_back(a[l]); return; }
int m = (l+r)/2;
build(node*2+1, l, m) , build(node*2+2, m, r);
seg[node] = seg[node*2+1];
int maxi = seg[node].back();
for(auto it:seg[node*2+2]) seg[node].push_back(it);
sort(seg[node].begin(),seg[node].end());
int ind = lower_bound(seg[node*2+2].begin(), seg[node*2+2].end(), maxi) - seg[node*2+2].begin(); ind--;
if(ind<0) ans[node] = 0;
else { ans[node] = seg[node*2+2][ind] + maxi; }
ans[node] = max ({ans[node], ans[node*2+1], ans[node*2+2]});
}
int fin = 0, maxi = 0;
void get ( int node, int l_n, int r_n, int l, int r) {
if(l_n>=r || r_n<=l) return;
if(l<=l_n && r>=r_n) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...