#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<vector<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<int> Megoldas;
vector<float> Helyezesek(n+1);
vector<float> Helyezesek2(n+1);
Helyezesek[0]=0;
Helyezesek2[0]=0;
for(int i=0;i<q;i++)
{
int helyezes,T;
cin>>helyezes>>T;
for(int j=1;j<=n;j++)
{float osszeg5=0;
if(T!=0){
osszeg5=T*AutokAdatatai[j][0]+AutokAdatatai[j][1]+AutokAdatatai[j][2]/T;
}
else
{
osszeg5=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 | Accepted | 3ms | 1808 KiB | ||||
subtask2 | 0/20 | ||||||
2 | Wrong answer | 418ms | 4028 KiB | ||||
3 | Wrong answer | 561ms | 4396 KiB | ||||
4 | Wrong answer | 564ms | 4460 KiB | ||||
5 | Wrong answer | 479ms | 4528 KiB | ||||
6 | Accepted | 514ms | 4716 KiB | ||||
7 | Accepted | 556ms | 4848 KiB | ||||
8 | Wrong answer | 508ms | 5056 KiB | ||||
9 | Wrong answer | 503ms | 5392 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Wrong answer | 446ms | 3864 KiB | ||||
11 | Wrong answer | 1.342s | 3700 KiB | ||||
12 | Time limit exceeded | 2.049s | 3172 KiB | ||||
13 | Time limit exceeded | 2.065s | 3132 KiB | ||||
14 | Time limit exceeded | 2.056s | 3336 KiB | ||||
15 | Time limit exceeded | 2.049s | 3280 KiB | ||||
16 | Time limit exceeded | 2.073s | 3280 KiB | ||||
17 | Time limit exceeded | 2.069s | 3236 KiB | ||||
18 | Time limit exceeded | 2.085s | 3300 KiB | ||||
subtask4 | 0/50 | ||||||
19 | Time limit exceeded | 2.059s | 3656 KiB | ||||
20 | Time limit exceeded | 2.042s | 3256 KiB | ||||
21 | Time limit exceeded | 2.099s | 3536 KiB | ||||
22 | Time limit exceeded | 2.053s | 3672 KiB | ||||
23 | Time limit exceeded | 2.062s | 3700 KiB | ||||
24 | Time limit exceeded | 2.066s | 3744 KiB | ||||
25 | Time limit exceeded | 2.069s | 3684 KiB | ||||
26 | Time limit exceeded | 2.078s | 3672 KiB | ||||
27 | Time limit exceeded | 2.062s | 3880 KiB | ||||
28 | Time limit exceeded | 2.058s | 3884 KiB | ||||
29 | Time limit exceeded | 2.069s | 4004 KiB | ||||
30 | Time limit exceeded | 2.078s | 3764 KiB |