117962024-11-11 11:14:19Leventusz09Forma-1cpp17Wrong answer 20/1002.089s5464 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
subtask220/20
2Accepted158ms5432 KiB
3Accepted159ms5460 KiB
4Accepted153ms5452 KiB
5Accepted150ms5456 KiB
6Accepted158ms5432 KiB
7Accepted150ms5428 KiB
8Accepted158ms5460 KiB
9Accepted149ms5464 KiB
subtask30/30
10Wrong answer521ms568 KiB
11Accepted1.228s568 KiB
12Time limit exceeded2.084s1604 KiB
13Time limit exceeded2.085s1592 KiB
14Time limit exceeded2.085s1592 KiB
15Time limit exceeded2.082s1592 KiB
16Time limit exceeded2.089s1592 KiB
17Time limit exceeded2.089s1524 KiB
18Time limit exceeded2.082s1592 KiB
subtask40/50
19Time limit exceeded2.076s4184 KiB
20Time limit exceeded2.076s4004 KiB
21Time limit exceeded2.078s3904 KiB
22Time limit exceeded2.078s3896 KiB
23Time limit exceeded2.082s3896 KiB
24Time limit exceeded2.085s3896 KiB
25Time limit exceeded2.085s3896 KiB
26Time limit exceeded2.085s3996 KiB
27Time limit exceeded2.079s3828 KiB
28Time limit exceeded2.084s3896 KiB
29Time limit exceeded2.084s3896 KiB
30Time limit exceeded2.084s3896 KiB