当前位置:网站首页>Template_ Quick sort_ Double pointer
Template_ Quick sort_ Double pointer
2022-07-06 02:21:00 【This question AC sleep again】
//
#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]; // Left Da Fu right Kong
while( in[j]>=tt && i<j ) j--;
in[i]=in[j]; // Right small Fu left empty
}
in[i]=tt; // place
fastpow( x,i-1 );
fastpow( i+1,y ); // Divide and conquer
}
}
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;
}边栏推荐
- SSM assembly
- Xshell 7 Student Edition
- vs code保存时 出现两次格式化
- [depth first search] Ji Suan Ke: Betsy's trip
- MySQL lethal serial question 1 -- are you familiar with MySQL transactions?
- 技术管理进阶——什么是管理者之体力、脑力、心力
- Use the list component to realize the drop-down list and address list
- Publish your own toolkit notes using NPM
- 从顶会论文看2022年推荐系统序列建模的趋势
- 2022 eye health exhibition, vision rehabilitation exhibition, optometry equipment exhibition, eye care products exhibition, eye mask Exhibition
猜你喜欢

Ue4- how to make a simple TPS role (II) - realize the basic movement of the role

Use the list component to realize the drop-down list and address list

PAT甲级 1033 To Fill or Not to Fill

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

2022 edition illustrated network pdf

【社区人物志】专访马龙伟:轮子不好用,那就自己造!

How to improve the level of pinduoduo store? Dianyingtong came to tell you

Computer graduation design PHP part-time recruitment management system for College Students

HttpRunnerManager安装(三)-Linux下配置myql数据库&初始化数据

Using SA token to solve websocket handshake authentication
随机推荐
Using SA token to solve websocket handshake authentication
Computer graduation design PHP campus restaurant online ordering system
SSM 程序集
SPI communication protocol
[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)
Genius storage uses documents, a browser caching tool
从顶会论文看2022年推荐系统序列建模的趋势
Leetcode3, implémenter strstr ()
[community personas] exclusive interview with Ma Longwei: the wheel is not easy to use, so make it yourself!
Redis daemon cannot stop the solution
Redis key operation
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
Keyword static
Xshell 7 Student Edition
Paper notes: limit multi label learning galaxc (temporarily stored, not finished)
Have a look at this generation
Lecture 4 of Data Engineering Series: sample engineering of data centric AI
leetcode3、實現 strStr()
[eight part essay] what is the difference between unrepeatable reading and unreal reading?
Black high-end responsive website dream weaving template (adaptive mobile terminal)