11796 | 2024-11-11 11:14:19 | Leventusz09 | Forma-1 | cpp17 | Wrong answer 20/100 | 2.089s | 5464 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<long long> a(N), b(N), c(N);
for(int i=0; i<N; i++){
cin >> a[i] >> b[i] >> c[i];
}
int Q;
cin >> Q;
vector<int> P(Q);
vector<long long> T(Q);
vector<int> o(Q);
for(int i=0; i<Q; i++){
int Pi;
long long Ti;
cin >> Pi >> Ti;
//cin >> P[i] >> T[i];
vector<pair<int, long long>> dist(N);
for(int j=0; j<N; j++){
dist[j].first = j;
dist[j].second = a[j] * Ti * Ti + b[j] * Ti + c[j];
}
sort(dist.begin(), dist.end(), [](pair<int, long long> a, pair<int, long long> b){
return a.second > b.second;
});
o[i] = dist[Pi-1].first;
//for(int j=0; j<N; j++) if(dist[j].first == Pi-1)
//cout << /*dist[0].second << "; " << dist[1].second <<*/ endl;
}
for(int i=0; i<Q; i++) cout << o[i] + 1 << "\n";
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 20/20 | ||||||
2 | Accepted | 158ms | 5432 KiB | ||||
3 | Accepted | 159ms | 5460 KiB | ||||
4 | Accepted | 153ms | 5452 KiB | ||||
5 | Accepted | 150ms | 5456 KiB | ||||
6 | Accepted | 158ms | 5432 KiB | ||||
7 | Accepted | 150ms | 5428 KiB | ||||
8 | Accepted | 158ms | 5460 KiB | ||||
9 | Accepted | 149ms | 5464 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Wrong answer | 521ms | 568 KiB | ||||
11 | Accepted | 1.228s | 568 KiB | ||||
12 | Time limit exceeded | 2.084s | 1604 KiB | ||||
13 | Time limit exceeded | 2.085s | 1592 KiB | ||||
14 | Time limit exceeded | 2.085s | 1592 KiB | ||||
15 | Time limit exceeded | 2.082s | 1592 KiB | ||||
16 | Time limit exceeded | 2.089s | 1592 KiB | ||||
17 | Time limit exceeded | 2.089s | 1524 KiB | ||||
18 | Time limit exceeded | 2.082s | 1592 KiB | ||||
subtask4 | 0/50 | ||||||
19 | Time limit exceeded | 2.076s | 4184 KiB | ||||
20 | Time limit exceeded | 2.076s | 4004 KiB | ||||
21 | Time limit exceeded | 2.078s | 3904 KiB | ||||
22 | Time limit exceeded | 2.078s | 3896 KiB | ||||
23 | Time limit exceeded | 2.082s | 3896 KiB | ||||
24 | Time limit exceeded | 2.085s | 3896 KiB | ||||
25 | Time limit exceeded | 2.085s | 3896 KiB | ||||
26 | Time limit exceeded | 2.085s | 3996 KiB | ||||
27 | Time limit exceeded | 2.079s | 3828 KiB | ||||
28 | Time limit exceeded | 2.084s | 3896 KiB | ||||
29 | Time limit exceeded | 2.084s | 3896 KiB | ||||
30 | Time limit exceeded | 2.084s | 3896 KiB |