当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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;
}边栏推荐
- Spark accumulator
- Global and Chinese market of wheelchair climbing machines 2022-2028: Research Report on technology, participants, trends, market size and share
- Overview of spark RDD
- leetcode3、实现 strStr()
- 729. 我的日程安排表 I / 剑指 Offer II 106. 二分图
- NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
- Numpy array index slice
- How to set an alias inside a bash shell script so that is it visible from the outside?
- Computer graduation design PHP college classroom application management system
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢

A basic lintcode MySQL database problem

Redis如何实现多可用区?
![Grabbing and sorting out external articles -- status bar [4]](/img/1e/2d44f36339ac796618cd571aca5556.png)
Grabbing and sorting out external articles -- status bar [4]

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

NiO related knowledge (II)

Computer graduation design PHP animation information website

Leetcode3, implémenter strstr ()

Adapter-a technology of adaptive pre training continuous learning
![[community personas] exclusive interview with Ma Longwei: the wheel is not easy to use, so make it yourself!](/img/aa/af98b588efd61d71b1b02609817c49.png)
[community personas] exclusive interview with Ma Longwei: the wheel is not easy to use, so make it yourself!

02.Go语言开发环境配置
随机推荐
Global and Chinese markets for single beam side scan sonar 2022-2028: Research Report on technology, participants, trends, market size and share
【机器人库】 awesome-robotics-libraries
通过PHP 获取身份证相关信息 获取生肖,获取星座,获取年龄,获取性别
PHP campus financial management system for computer graduation design
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Leetcode3, implémenter strstr ()
Selenium waiting mode
NumPy 数组索引 切片
02.Go语言开发环境配置
Jisuanke - t2063_ Missile interception
Concept of storage engine
Paper notes: limit multi label learning galaxc (temporarily stored, not finished)
SQL statement
使用npm发布自己开发的工具包笔记
MySQL lethal serial question 1 -- are you familiar with MySQL transactions?
GBase 8c数据库升级报错
Multi function event recorder of the 5th National Games of the Blue Bridge Cup
Formatting occurs twice when vs code is saved
General process of machine learning training and parameter optimization (discussion)
The intelligent material transmission system of the 6th National Games of the Blue Bridge Cup