Submission #210895

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2108952020-03-19 01:43:442qbingxuanBubble Sort 2 (JOI18_bubblesort2)C++14
60 / 100
418 ms55488 KiB
#pragma g++ optimize("Ofast")
#include <bits/stdc++.h>
#define pb emplace_back
#define get_pos(u,x) (lower_bound(begin(u),end(u),x) - begin(u))
using namespace std;
const int N = 500025;
struct Segtree {
int n;
vector<int> mx, lz;
void init(int v[], int _n) {
n = _n;
mx.resize(n*2), lz.resize(n);
for(int i = 0; i < n; i++) mx[i+n] = v[i], lz[i] = 0;
for(int i = n-1; i > 0; i--) mx[i] = max(mx[i<<1], mx[i<<1|1]);
}
void upd(int p, int d) {
mx[p] += d;
if(p < n) lz[p] += d;
}
void pull(int p) {
for(; p>1; p>>=1) mx[p>>1] = max(mx[p],mx[p^1]) + lz[p>>1];
}
void push(int p) {
for(int h = __lg(n); h >= 0; h--) {
int i = p>>h;
if(!lz[i>>1]) continue;
upd(i,lz[i>>1]);
upd(i^1,lz[i>>1]);
lz[i>>1] = 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bubblesort2.cpp:1:0: warning: ignoring #pragma g  [-Wunknown-pragmas]
 #pragma g++ optimize("Ofast")
 
bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:69:14: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
     for(auto [val, id]: u) {
              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...