当前位置:网站首页>模板_快速排序_双指针
模板_快速排序_双指针
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 hitting traffic doors 2022-2028: Research Report on technology, participants, trends, market size and share
- 数据工程系列精讲(第四讲): Data-centric AI 之样本工程
- Visualstudio2019 compilation configuration lastools-v2.0.0 under win10 system
- Apicloud openframe realizes the transfer and return of parameters to the previous page - basic improvement
- Selenium element positioning (2)
- Multi function event recorder of the 5th National Games of the Blue Bridge Cup
- Xshell 7 Student Edition
- Online reservation system of sports venues based on PHP
- 01.Go语言介绍
- 竞价推广流程
猜你喜欢

Computer graduation design PHP college student human resources job recruitment network

Leetcode3, implémenter strstr ()

在线怎么生成富文本

Spark accumulator

Selenium waiting mode

Unity learning notes -- 2D one-way platform production method

Tensorflow customize the whole training process

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年版图解网络PDF

Minecraft 1.18.1、1.18.2模组开发 22.狙击枪(Sniper Rifle)
随机推荐
Global and Chinese markets hitting traffic doors 2022-2028: Research Report on technology, participants, trends, market size and share
PHP campus movie website system for computer graduation design
How does redis implement multiple zones?
2022年PMP项目管理考试敏捷知识点(8)
安装php-zbarcode扩展时报错,不知道有没有哪位大神帮我解决一下呀 php 环境用的7.3
怎么检查GBase 8c数据库中的锁信息?
Using SA token to solve websocket handshake authentication
[eight part essay] what is the difference between unrepeatable reading and unreal reading?
SPI communication protocol
leetcode-两数之和
Selenium element positioning (2)
Bidding promotion process
Computer graduation design PHP part-time recruitment management system for College Students
Thinking about the best practice of dynamics 365 development collaboration
Blue Bridge Cup embedded_ STM32_ New project file_ Explain in detail
1. Introduction to basic functions of power query
[Clickhouse] Clickhouse based massive data interactive OLAP analysis scenario practice
vs code保存时 出现两次格式化
Genius storage uses documents, a browser caching tool
Leetcode3, implémenter strstr ()