当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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;
}
边栏推荐
- RDD creation method of spark
- [flask] official tutorial -part2: Blueprint - view, template, static file
- 【coppeliasim】6自由度路径规划
- Have a look at this generation
- 正则表达式:示例(1)
- Genius storage uses documents, a browser caching tool
- Minecraft 1.16.5 生化8 模组 2.0版本 故事书+更多枪械
- Global and Chinese markets for single beam side scan sonar 2022-2028: Research Report on technology, participants, trends, market size and share
- Numpy array index slice
- Formatting occurs twice when vs code is saved
猜你喜欢
Online reservation system of sports venues based on PHP
2022年PMP项目管理考试敏捷知识点(8)
[Clickhouse] Clickhouse based massive data interactive OLAP analysis scenario practice
Leetcode sum of two numbers
Lecture 4 of Data Engineering Series: sample engineering of data centric AI
Concept of storage engine
Kubernetes stateless application expansion and contraction capacity
Initialize MySQL database when docker container starts
论文笔记: 图神经网络 GAT
Grabbing and sorting out external articles -- status bar [4]
随机推荐
MySQL index
How to use C to copy files on UNIX- How can I copy a file on Unix using C?
Redis如何实现多可用区?
01.Go语言介绍
【clickhouse】ClickHouse Practice in EOI
NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
[robot library] awesome robots Libraries
02. Go language development environment configuration
【机器人库】 awesome-robotics-libraries
PHP campus movie website system for computer graduation design
Computer graduation design PHP campus restaurant online ordering system
Jisuanke - t2063_ Missile interception
Apicloud openframe realizes the transfer and return of parameters to the previous page - basic improvement
leetcode-2. Palindrome judgment
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
2022 edition illustrated network pdf
[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)
[solution] every time idea starts, it will build project
[community personas] exclusive interview with Ma Longwei: the wheel is not easy to use, so make it yourself!
leetcode-2.回文判断