#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);
}
vector<float> Tegyenlonulla(n+1);
Tegyenlonulla[0]=0;
for(int j=1;j<=n;j++)
{
Tegyenlonulla[j]=AutokAdatatai[j][2];
}
vector<float> Helyezeseknagyobb(n+1);
Helyezeseknagyobb[0]=0;
for(int j=1;j<=n;j++)
{
Helyezeseknagyobb[j]=AutokAdatatai[j][0];
}
vector<float> Helyezesek(n+1);
vector<float> Helyezesek2(n+1);
Helyezesek[0]=0;
Helyezesek2[0]=0;
int q;
cin>>q;
vector<int> Megoldas;
for(int i=0;i<q;i++)
{
int helyezes,T;
cin>>helyezes>>T;
if(T==0)
{
Helyezesek=Tegyenlonulla;
}
else
if(T>=1000)
{
Helyezesek=Helyezeseknagyobb;
}
else
{
for(int j=1;j<=n;j++)
{float osszeg5=0;
osszeg5=T*AutokAdatatai[j][0]+AutokAdatatai[j][1]+AutokAdatatai[j][2]/T;
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 | 1956 KiB | ||||
subtask2 | 0/20 | ||||||
2 | Wrong answer | 517ms | 4268 KiB | ||||
3 | Wrong answer | 416ms | 4384 KiB | ||||
4 | Wrong answer | 481ms | 4480 KiB | ||||
5 | Wrong answer | 523ms | 4596 KiB | ||||
6 | Wrong answer | 421ms | 4652 KiB | ||||
7 | Wrong answer | 615ms | 4676 KiB | ||||
8 | Wrong answer | 495ms | 4856 KiB | ||||
9 | Accepted | 504ms | 5080 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Wrong answer | 241ms | 3736 KiB | ||||
11 | Wrong answer | 340ms | 3576 KiB | ||||
12 | Wrong answer | 1.254s | 4208 KiB | ||||
13 | Wrong answer | 1.297s | 4360 KiB | ||||
14 | Wrong answer | 1.375s | 4324 KiB | ||||
15 | Wrong answer | 1.444s | 4476 KiB | ||||
16 | Wrong answer | 1.531s | 4516 KiB | ||||
17 | Wrong answer | 1.638s | 4676 KiB | ||||
18 | Time limit exceeded | 2.071s | 3580 KiB | ||||
subtask4 | 0/50 | ||||||
19 | Time limit exceeded | 2.069s | 3960 KiB | ||||
20 | Time limit exceeded | 2.069s | 3868 KiB | ||||
21 | Time limit exceeded | 2.058s | 3848 KiB | ||||
22 | Time limit exceeded | 2.055s | 3996 KiB | ||||
23 | Time limit exceeded | 2.066s | 3912 KiB | ||||
24 | Time limit exceeded | 2.066s | 4052 KiB | ||||
25 | Time limit exceeded | 2.071s | 3712 KiB | ||||
26 | Time limit exceeded | 2.049s | 4132 KiB | ||||
27 | Time limit exceeded | 2.058s | 3940 KiB | ||||
28 | Time limit exceeded | 2.066s | 4160 KiB | ||||
29 | Time limit exceeded | 2.051s | 4168 KiB | ||||
30 | Time limit exceeded | 2.071s | 3964 KiB |