当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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;
}边栏推荐
- 在线怎么生成富文本
- Global and Chinese markets of nasal oxygen tubes 2022-2028: Research Report on technology, participants, trends, market size and share
- Redis daemon cannot stop the solution
- 2022 PMP project management examination agile knowledge points (8)
- 2 power view
- How to improve the level of pinduoduo store? Dianyingtong came to tell you
- How does redis implement multiple zones?
- Leetcode3. Implement strstr()
- Computer graduation design PHP college student human resources job recruitment network
- 插卡4G工业路由器充电桩智能柜专网视频监控4G转以太网转WiFi有线网速测试 软硬件定制
猜你喜欢

Prepare for the autumn face-to-face test questions

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

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

Overview of spark RDD

leetcode3、實現 strStr()

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

Computer graduation design PHP college classroom application management system

Campus second-hand transaction based on wechat applet

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

Computer graduation design PHP college student human resources job recruitment network
随机推荐
Computer graduation design PHP campus restaurant online ordering system
selenium 元素定位(2)
【coppeliasim】高效传送带
Method of changing object properties
Open source | Ctrip ticket BDD UI testing framework flybirds
阿裏測開面試題
MySQL index
NiO related knowledge (II)
Shutter doctor: Xcode installation is incomplete
[network attack and defense training exercises]
VIM usage guide
Flowable source code comments (36) process instance migration status job processor, BPMN history cleanup job processor, external worker task completion job processor
安装php-zbarcode扩展时报错,不知道有没有哪位大神帮我解决一下呀 php 环境用的7.3
Text editing VIM operation, file upload
Comments on flowable source code (XXXV) timer activation process definition processor, process instance migration job processor
Use the list component to realize the drop-down list and address list
Global and Chinese markets of screw rotor pumps 2022-2028: Research Report on technology, participants, trends, market size and share
Blue Bridge Cup embedded_ STM32_ New project file_ Explain in detail
RDD creation method of spark
【机器人手眼标定】eye in hand