Yao Yao's K-daTime
limit:2000MS
Memory Limit:128000KB
64bit IO Format:%lld &%llu SubmitStatusPracticeacdream 1099
Description
One day, the sister of Meng-Yao (Tsyao) is very boring, come to you to play. But you don't even know what to play. Embarrassed for a while, the witty Yao Yao proposed: "So, you say N integer XI, and then at random to say a number K, I can quickly say the numbers inside the K large number." ”
Input
Line 1th Two integer N, K separated by a space;
The 2nd line has N integers (which can appear the same number, all randomly generated), also separated by a space.
0 < N≤5*10^6, 0 < K≤n
1≤xi≤10^8
Output
Output section
kThe big numbers.
Sample Input
5 25 4 1 3 1
Sample Output
4
Hint
In the case of 2,2,1, the first of the three numbers is 2, the second is 2, and the third is 1. Problem-solving ideas: hand-beating fast platoon, directional, purposeful selection of interval division, input plug optimization.
#include <stdio.h> #include <algorithm> #include <string.h>using namespace Std;const int Maxn=1e7;int A[maxn];int Scan () {char C; int Sgn,ret; if (C=getchar (), c==eof) return 0; while (c!= '-' && (c< ' 0 ' | | C> ' 9 ')) C=getchar (); sgn= (c== '-')? -1:1; ret= (c== '-')? 0: (c ' 0 '); while (C=getchar (), c>= ' 0 ' &&c<= ' 9 ') ret=ret*10+ (c ' 0 '); RET *=SGN; return ret;} int mysort (int l,int r,int k) {if (l==r) {//interval has only one value, that is, the K-value return a[l]; } int key=a[l]; int low=l; int high=r; while (Low
Acdream 1099 —————— "quick platoon half, input plug-in"