当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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;
}边栏推荐
- Social networking website for college students based on computer graduation design PHP
- [coppeliasim] efficient conveyor belt
- RDD creation method of spark
- Extracting key information from TrueType font files
- Leetcode3. Implement strstr()
- SQL statement
- Redis string type
- Minecraft 1.18.1、1.18.2模组开发 22.狙击枪(Sniper Rifle)
- Global and Chinese market of wheelchair climbing machines 2022-2028: Research Report on technology, participants, trends, market size and share
- 2 power view
猜你喜欢

PHP campus movie website system for computer graduation design

Publish your own toolkit notes using NPM

Open source | Ctrip ticket BDD UI testing framework flybirds

2 power view

Online reservation system of sports venues based on PHP

2022 PMP project management examination agile knowledge points (8)

500 lines of code to understand the principle of mecached cache client driver

Blue Bridge Cup embedded_ STM32_ New project file_ Explain in detail

The intelligent material transmission system of the 6th National Games of the Blue Bridge Cup

Selenium waiting mode
随机推荐
NiO related knowledge (II)
论文笔记: 图神经网络 GAT
论文笔记: 极限多标签学习 GalaXC (暂存, 还没学完)
sql表名作为参数传递
Minecraft 1.16.5 biochemical 8 module version 2.0 storybook + more guns
How to improve the level of pinduoduo store? Dianyingtong came to tell you
[depth first search notes] Abstract DFS
【coppeliasim】6自由度路径规划
Xshell 7 Student Edition
Visualstudio2019 compilation configuration lastools-v2.0.0 under win10 system
[solution] every time idea starts, it will build project
2 power view
Publish your own toolkit notes using NPM
How to use C to copy files on UNIX- How can I copy a file on Unix using C?
使用npm发布自己开发的工具包笔记
Global and Chinese market of commercial cheese crushers 2022-2028: Research Report on technology, participants, trends, market size and share
Pangolin Library: subgraph
Accelerating spark data access with alluxio in kubernetes
Flowable source code comments (36) process instance migration status job processor, BPMN history cleanup job processor, external worker task completion job processor
I like Takeshi Kitano's words very much: although it's hard, I will still choose that kind of hot life