#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<vector<long long int>> AutokAdatatai(n+2);
for(int i=1;i<=n;i++)
{
//cout<<"i="<<i<<" n="<<n<<endl;
int a,b,c;
cin>>a>>b>>c;
AutokAdatatai[i].push_back(a);
AutokAdatatai[i].push_back(b);
AutokAdatatai[i].push_back(c);
}
int q;
cin>>q;
vector<long long int> Megoldas;
vector<long long int> Helyezesek(n+1);
vector<long long int> Helyezesek2(n+1);
Helyezesek[0]=0;
Helyezesek2[0]=0;
for(int i=0;i<q;i++)
{
long long int helyezes,T;
cin>>helyezes>>T;
long long int T2=T*T;
for(int j=1;j<=n;j++)
{
long long int osszeg5=T2*AutokAdatatai[j][0]+T*AutokAdatatai[j][1]+AutokAdatatai[j][2];
Helyezesek[j]=osszeg5;
}
Helyezesek2=Helyezesek;
/*cout<<endl<<endl;
for(int i=1;i<=n;i++)
{
cout<<Helyezesek2[i]<<" ";
}
cout<<endl;*/
sort(Helyezesek.begin(),Helyezesek.end());
int szam=Helyezesek[n-helyezes+1]; // cout<<szam<<endl<<endl;
for(int i=1;i<=n;i++)
{
if(Helyezesek2[i]==szam)
{
Megoldas.push_back(i);
break;
}
}
}
for(int i=0;i<Megoldas.size();i++)
{
cout<<Megoldas[i]<<endl;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1812 KiB | ||||
subtask2 | 0/20 | ||||||
2 | Wrong answer | 246ms | 4076 KiB | ||||
3 | Wrong answer | 215ms | 3456 KiB | ||||
4 | Wrong answer | 279ms | 4560 KiB | ||||
5 | Wrong answer | 232ms | 3960 KiB | ||||
6 | Wrong answer | 127ms | 3216 KiB | ||||
7 | Wrong answer | 126ms | 3292 KiB | ||||
8 | Wrong answer | 122ms | 3260 KiB | ||||
9 | Wrong answer | 120ms | 3392 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Wrong answer | 460ms | 4036 KiB | ||||
11 | Wrong answer | 1.172s | 3988 KiB | ||||
12 | Time limit exceeded | 2.065s | 3372 KiB | ||||
13 | Time limit exceeded | 2.04s | 3248 KiB | ||||
14 | Time limit exceeded | 2.062s | 3232 KiB | ||||
15 | Time limit exceeded | 2.056s | 3736 KiB | ||||
16 | Time limit exceeded | 2.081s | 3696 KiB | ||||
17 | Time limit exceeded | 2.045s | 3708 KiB | ||||
18 | Time limit exceeded | 2.075s | 3864 KiB | ||||
subtask4 | 0/50 | ||||||
19 | Time limit exceeded | 2.078s | 4200 KiB | ||||
20 | Time limit exceeded | 2.026s | 4068 KiB | ||||
21 | Time limit exceeded | 2.075s | 4080 KiB | ||||
22 | Time limit exceeded | 2.062s | 4016 KiB | ||||
23 | Time limit exceeded | 2.065s | 4064 KiB | ||||
24 | Time limit exceeded | 2.082s | 4028 KiB | ||||
25 | Time limit exceeded | 2.068s | 4080 KiB | ||||
26 | Time limit exceeded | 2.082s | 4144 KiB | ||||
27 | Time limit exceeded | 2.065s | 4228 KiB | ||||
28 | Time limit exceeded | 2.073s | 4052 KiB | ||||
29 | Time limit exceeded | 2.062s | 4096 KiB | ||||
30 | Time limit exceeded | 2.046s | 4048 KiB |