当前位置:网站首页>Luogu p1168 median
Luogu p1168 median
2022-07-01 00:19:00 【Star_.】
Original link
Look, the label is a segment tree , Tree array , Previously learned segment tree , Tree array and so on are almost forgotten , I thought it would be a long war , I didn't expect to see an immortal when I read the solution . Using dynamic arrays vector and upper_bound The function passed
I know for the first time insert add upper_bound Can sort . This saves us the most time-consuming sorting problem
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=0x7fffffff;
const int N = 1e6+5;
const int mod=100003;
int main()
{
ios::sync_with_stdio(false);
vector<int> v;
int n,x;
cin>>n;
for(int i=1;i<=n;i++){
cin>>x;
v.insert(upper_bound(v.begin(),v.end(),x),x);
if(i%2==1)
cout<<v[(i-1)/2]<<endl;
}
return 0;
}
边栏推荐
- When is it appropriate to replace a virtual machine with a virtual machine?
- [PHP] self developed framework qphp, used by qphp framework
- Dataloader source code_ DataLoader
- Never use redis expired monitoring to implement scheduled tasks!
- 2022-06-30:以下golang代码输出什么?A:0;B:2;C:运行错误。 package main import “fmt“ func main()
- Yboj mesh sequence [Lagrange interpolation]
- Warmup preheating learning rate "suggestions collection"
- On the application of cluster analysis in work
- 6-1 exploit -ftp exploit
- Is it safe to choose mobile phone for stock trading account opening in Hangzhou?
猜你喜欢

让企业数字化砸锅和IT主管背锅的软件供应链安全风险指北

2022-2028 global rotary transmission system industry research and trend analysis report

20220215-ctf-misc-buuctf-ningen--binwalk analysis --dd command separation --archpr brute force cracking

ABAQUS 2022 software installation package and installation tutorial

Software supply chain security risk pointing North for enterprise digitalization and it executives

Detailed explanation of conv2d -- use in arrays and images

Ditto set global paste only text shortcuts

Fh6908a negative pole turn off synchronous rectification analog low voltage drop diode control IC chip tsot23-6 ultra low power rectifier 1W power consumption < 100ua static replacement mp6908

CTF tool (1) -- archpr -- including installation / use process

Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
随机推荐
Is it safe to choose mobile phone for stock trading account opening in Guangzhou?
1175. prime number arrangement / Sword finger offer II 104 Number of permutations
Red Hat将在Project Atomic上运用容器负载服务器
Which is better, server rental or hosting services in the United States?
2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
Understand target detection in one article: r-cnn, fast r-cnn, fast r-cnn, Yolo, SSD "suggestions collection"
Thoughts on the future of data analysis in "miscellaneous talk"
[designmode] singleton pattern
2022-2028 global encrypted external hard disk industry research and trend analysis report
Design e-commerce seckill system
Repetition is the mother of skill
Pycharm useful shortcut keys
SSM integration process (integration configuration, function module development, interface test)
需求评审,测试人员应该发挥怎样的价值?两分钟让你不再懵逼
When is it appropriate to replace a virtual machine with a virtual machine?
Rust controls Dajiang programmable UAV Tello
shell 同时执行多任务下载视频
File reading and writing for rust file system processing - rust Practice Guide
CentOS installation starts redis
什么是SRM系统,如何规范公司内部采购流程