当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
2022-07-06 02:06:00 【这题AC再睡.】
//
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+6;
int in[N];
void fastpow( int x,int y )
{
if( x<y )
{
int i=x,j=y,tt=in[y];
while( i<j )
{
while( in[i]<=tt && i<j ) i++;
in[j]=in[i]; // 左大赋右空
while( in[j]>=tt && i<j ) j--;
in[i]=in[j]; // 右小赋左空
}
in[i]=tt; // 归位
fastpow( x,i-1 );
fastpow( i+1,y ); // 分治
}
}
int main()
{
int n,i;
while( cin>>n )
{
for( i=0;i<n;i++ ) cin>>in[i];
fastpow( 0,n-1 );
for( i=0;i<n;i++ )
{
if( i ) cout<<" ";
cout<<in[i];
}
cout<<endl;
}
return 0;
}边栏推荐
- 【coppeliasim】6自由度路径规划
- Open source | Ctrip ticket BDD UI testing framework flybirds
- 【机器人库】 awesome-robotics-libraries
- 【coppeliasim】高效传送带
- Ali test open-ended questions
- Initialize MySQL database when docker container starts
- 一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
- Competition question 2022-6-26
- Ali test Open face test
- Minecraft 1.16.5 biochemical 8 module version 2.0 storybook + more guns
猜你喜欢

NiO related knowledge (II)

Social networking website for college students based on computer graduation design PHP

vs code保存时 出现两次格式化

02. Go language development environment configuration

It's wrong to install PHP zbarcode extension. I don't know if any God can help me solve it. 7.3 for PHP environment

Visualstudio2019 compilation configuration lastools-v2.0.0 under win10 system

Kubernetes stateless application expansion and contraction capacity

Lecture 4 of Data Engineering Series: sample engineering of data centric AI

Unity learning notes -- 2D one-way platform production method

How to upgrade kubernetes in place
随机推荐
Bidding promotion process
General process of machine learning training and parameter optimization (discussion)
Compact lidar global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
【coppeliasim】高效传送带
Campus second-hand transaction based on wechat applet
Adapter-a technology of adaptive pre training continuous learning
2022 edition illustrated network pdf
论文笔记: 图神经网络 GAT
leetcode-两数之和
Global and Chinese markets for single beam side scan sonar 2022-2028: Research Report on technology, participants, trends, market size and share
Minecraft 1.16.5 生化8 模组 2.0版本 故事书+更多枪械
Computer graduation design PHP college classroom application management system
NiO related knowledge (II)
Global and Chinese market of commercial cheese crushers 2022-2028: Research Report on technology, participants, trends, market size and share
Get the relevant information of ID card through PHP, get the zodiac, get the constellation, get the age, and get the gender
02. Go language development environment configuration
[eight part essay] what is the difference between unrepeatable reading and unreal reading?
Use the list component to realize the drop-down list and address list
Computer graduation design PHP enterprise staff training management system
Use image components to slide through photo albums and mobile phone photo album pages