117972024-11-11 11:21:24Leventusz09Forma-1cpp17Wrong answer 20/1002.086s832 KiB
#include <bits/stdc++.h>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    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;

    for(int i=0, j; i<Q; i++){
        int Pi;
        long long Ti;
        cin >> Pi >> Ti;
        vector<pair<int, long long>> dist(N);
        for(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;
        });

        cout << dist[Pi-1].first+1 << "\n";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
subtask220/20
2Accepted72ms728 KiB
3Accepted74ms764 KiB
4Accepted72ms724 KiB
5Accepted72ms720 KiB
6Accepted74ms824 KiB
7Accepted72ms832 KiB
8Accepted74ms824 KiB
9Accepted71ms824 KiB
subtask30/30
10Wrong answer514ms500 KiB
11Accepted1.217s500 KiB
12Time limit exceeded2.086s536 KiB
13Time limit exceeded2.086s564 KiB
14Time limit exceeded2.085s564 KiB
15Time limit exceeded2.085s568 KiB
16Time limit exceeded2.078s320 KiB
17Time limit exceeded2.078s544 KiB
18Time limit exceeded2.075s568 KiB
subtask40/50
19Time limit exceeded2.082s568 KiB
20Time limit exceeded2.082s568 KiB
21Time limit exceeded2.082s568 KiB
22Time limit exceeded2.082s508 KiB
23Time limit exceeded2.082s532 KiB
24Time limit exceeded2.082s568 KiB
25Time limit exceeded2.082s568 KiB
26Time limit exceeded2.082s512 KiB
27Time limit exceeded2.085s500 KiB
28Time limit exceeded2.085s560 KiB
29Time limit exceeded2.085s568 KiB
30Time limit exceeded2.085s504 KiB