当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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 partition rules of spark
- 一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
- [robot library] awesome robots Libraries
- [flask] official tutorial -part2: Blueprint - view, template, static file
- Competition question 2022-6-26
- 【coppeliasim】6自由度路径规划
- vs code保存时 出现两次格式化
- 【coppeliasim】高效传送带
- Bidding promotion process
- Grabbing and sorting out external articles -- status bar [4]
猜你喜欢
Redis list
Computer graduation design PHP part-time recruitment management system for College Students
【社区人物志】专访马龙伟:轮子不好用,那就自己造!
[solution] every time idea starts, it will build project
插卡4G工业路由器充电桩智能柜专网视频监控4G转以太网转WiFi有线网速测试 软硬件定制
Multi function event recorder of the 5th National Games of the Blue Bridge Cup
2022年版图解网络PDF
How does redis implement multiple zones?
抓包整理外篇——————状态栏[ 四]
Overview of spark RDD
随机推荐
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
Genius storage uses documents, a browser caching tool
Blue Bridge Cup embedded_ STM32 learning_ Key_ Explain in detail
竞价推广流程
1. Introduction to basic functions of power query
Redis如何实现多可用区?
Computer graduation design PHP campus restaurant online ordering system
Know MySQL database
Global and Chinese markets of nasal oxygen tubes 2022-2028: Research Report on technology, participants, trends, market size and share
Lecture 4 of Data Engineering Series: sample engineering of data centric AI
Method of changing object properties
729. My schedule I / offer II 106 Bipartite graph
[eight part essay] what is the difference between unrepeatable reading and unreal reading?
GBase 8c数据库升级报错
Multi function event recorder of the 5th National Games of the Blue Bridge Cup
Virtual machine network, networking settings, interconnection with host computer, network configuration
【社区人物志】专访马龙伟:轮子不好用,那就自己造!
【coppeliasim】6自由度路径规划
Leetcode sum of two numbers