QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#29399 | #2643. Bubble Sort 2 | ETK | Compile Error | / | / | C++23 | 1.9kb | 2022-04-17 17:23:14 | 2024-07-05 05:53:12 |
Judging History
你现在查看的是测评时间为 2024-07-05 05:53:12 的历史记录
- [2024-07-05 05:53:12]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-04-17 17:23:14]
- 提交
answer
#include "bubblesort2.h"
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define ll long long
using namespace std;
inline ll read(){
ll x=0,f=1;char ch=getchar();
while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
}
const int inf=INT_MAX/2;
int s;
vi mx,lz;
void init(int n){
s=1;
while(s<n)s*=2;
mx.resize(2*s,0),lz.resize(2*s,0);
}
#define ls (p<<1)
#define rs (p<<1|1)
void pushdown(int p){
if(!lz[p])return;
mx[p]+=lz[p],lz[ls]+=lz[p],lz[rs]+=lz[p];
lz[p]=0;
}
int Q(int p){return mx[p]+lz[p];}
void Add(int p,int L,int R,int l,int r,int v){
if(r<=L||R<=l)return;
if(l<=L&&R<=r){
lz[p]+=v;
return;
}
pushdown(p);
int mid=(L+R)>>1;
Add(ls,L,mid,l,r,v);
Add(rs,mid,R,l,r,v);
mx[p]=max(Q(ls),Q(rs));
}
void Add(int l,int r,int v){
if(l<r)Add(1,0,s,l,r,v);
}
vi countScans(vi a,vi x,vi v){
int n=a.size(),q=x.size();
vector<pii> lsh;
rep(i,0,n-1)lsh.pb(pii(a[i],i));
rep(i,0,q-1)lsh.pb(pii(v[i],x[i]));
sort(ALL(lsh));
lsh.erase(unique(ALL(lsh)),lsh.end());
int s=lsh.size();
init(s);
Add(0,s,-inf);
const auto insert = [&](int p,int r){
int i=lower_bound(ALL(lsh),pii(p,r))-lsh.begin();
Add(i,i+1,inf+r);Add(i+1,s,-1);
};
const auto erase = [&](int p,int r){
int i=lower_bound(ALL(lsh),pii(p,r))-lsh.begin();
Add(i,i+1,-(inf+r));Add(i+1,s,1);
};
rep(i,0,n-1)insert(a[i],i);
vi res(q);
rep(i,0,q-1){
erase(a[x[i]],x[i]);
insert(v[i],x[i]);
a[x[i]]=v[i];res[i]=Q(1);
}
return res;
}
詳細信息
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status