Submission #342943

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3429432021-01-03 08:58:04TosicHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
0 / 100
267 ms44908 KiB
#include <bits/stdc++.h>
#define maxn 800010
using namespace std;
int n, m, a[maxn], allR[maxn], ans;
vector<int> sorted[maxn];
void init(int idx, int l, int r){
//cerr<< idx<< '\n';
if(l == r){
//segTree[idx].maxS = segTree[idx].minS = a[l];
//cerr<< 'a';
sorted[idx]={a[l]};
//cerr<<'b';
return;
}
int mid = (r+l)/2;
init(idx*2+1, l, mid);
init(idx*2+2, mid+1, r);
//cerr<< sorted[idx*2+1].size( ) << '\n';
//segTree[idx].maxS = max(segTree[idx*2+1].maxS, segTree[idx*2+2].maxS);
//segTree[idx].minS = min(segTree[idx*2+1].minS, segTree[idx*2+2].minS);
//segTree[idx].res = max(segTree[idx*2+1].res, segTree[idx*2+2].res);
//int n1 =sorted[idx*2+1].size(), m1 = sorted[idx*2+2].size();
//cerr<< sorted[idx*2+1].size() << '\n';
sorted[idx].resize(sorted[idx*2+1].size()+sorted[idx*2+2].size());
merge(sorted[idx*2+1].begin(), sorted[idx*2+1].end(), sorted[idx*2+2].begin(), sorted[idx*2+2].end(), sorted[idx].begin());
// for(int i = 0, j = 0; i < n1 and j < m1; i = min(i, n1-1), j =min(j, m1-1)){
// int a = sorted[idx*2+1][i], b = sorted[idx*2+2][j];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...