Resolve
Spicy chicken face ruin my youth title
Because the problem face translated and wrote a \ (the rest of the n-k does not complete \) .
So I thought the rest of the \ (nk \) months will count value is not satisfied.
(But the fact is that only \ (pk \) more ...)
First, according to the rules of the President, we can first Imperial \ (pk \) absolutely not be selected task,
The \ (B \) descending, then \ (A \) ascending rearmost taken on the line.
(It should be easy to understand it ...)
Then put the rest of the press \ (a \) descending,
Then \ (b \) in descending order, before taking \ (k \) th is the largest white hair situation.
Here the \ (b \) descending because the rest of the (pk \) \ a dissatisfaction but also the largest,
So if there is a descending more opportunities.
Then consider the rest of the \ (pk \) a,
Because before King James is not necessarily the biggest case of dissatisfaction,
So we have to press the first order,
Before taking already took the \ (k \) months after the last in the face of the task \ (pk \) th on the list.
This may sound a little convoluted ...
Because we want to ensure that the rest of the \ (pk \) one can not interfere in front of \ (k \) th (ie higher priority in the Chair's rule).
And then himself \ (yy \) under should be on the list.
Another point to note is that
Because there are two tasks may \ (a, b \) are equal,
So the results may not be the same sort twice (because the WA to spit ...)
So when ordering the number as the third key just fine.
code:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fre(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
using namespace std;
inline int read(){
int sum=0,f=1;char ch=getchar();
while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
return f*sum;
}
const int N=200005;
struct node{int x,y,tag,id,pos;}a[N],b[N];
int n,K,P,sum=0x3f3f3f3f,ret=0;
inline bool cmp(node a,node b){
return a.y!=b.y? a.y<b.y:a.x>b.x;
}
inline bool cmp1(node a,node b){
// if(a.tag!=b.tag) return a.tag<b.tag;
if(a.x!=b.x) return a.x>b.x;
return a.y>b.y;
}
inline bool cmp2(node a,node b){return a.y!=b.y? a.y>b.y:a.x<b.x;}
signed main(){
n=read();P=read();K=read();
for(int i=1;i<=n;i++) a[i].x=read(),a[i].y=read();
for(int i=1;i<=n;i++) a[i].id=i;
sort(a+1,a+n+1,cmp2);
memcpy(b,a,sizeof(b));
for(int i=1;i<=n;i++) a[i].pos=i;
int ss=P-K;
sort(a+1,a+n-ss+1,cmp1);
for(int i=1;i<=K;i++) printf("%d ",a[i].id);
for(int i=1;i<=K;i++) ret=max(ret,a[i].pos);
// sort(a+ret+1,a+n+1,cmp2);
for(int i=1;i<=ss;i++){
printf("%d ",b[i+ret].id);
}
// for(int i=1;i<=n;i++) if(a[i].tag) printf("%d ",a[i].id);
puts("");
return 0;
}