#include <bits/stdc++.h>
#define ll long long
#define oi ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
const ll N = 1e6;
ll n, r, q, x=1, y=2;
ll a[N], b[N], c[N];
void aa()
{
for(int i=1; i<=n*2; i++)
{
for(int j=1; j<=n*2; j++)
{
if(a[j+1]>a[j])
swap(a[j], a[j+1]),swap(c[j], c[j+1]);
else if(a[j+1]==a[j]&&c[j]>c[j+1])swap(a[j], a[j+1]),swap(c[j], c[j+1]);
}
}
}
int main()
{
//freopen("swiss.in", "r", stdin);
//freopen("swiss.out", "w",stdout);
oi;
cin>>n>>r>>q;
int m=n*2;
for(int i=1; i<=m; i++)
cin>>a[i]>>b[i], c[i]=i;
aa();
for(int i=1; i<=r; i++)
{
while(x<m&&y<=m)
{
if(b[x]>b[y]) a[x]++;
if(b[x]<b[y]) a[y]++;
x+=2, y+=2;
}
aa();
}
cout<<c[q];
return 0;
}
这是打模拟赛时写的......超级乱啊