3172 2023. 02. 21 13:13:09 TuruTamas Szurikáta (45) cpp17 Időlimit túllépés 10/45 375ms 3668 KiB
#include <bits/stdc++.h>

using namespace std;

int N, P, Q;
vector<pair<int, int>> X;


int doCrap(vector<double>& slope) {
    double maxslope = slope[0];
    int count = 1;
    for (size_t i = 1; i < slope.size(); i++)
    {
        if (slope[i] > maxslope) {
            count++;
            maxslope = slope[i];
        }
    }
    return count;
}

int main() {
    cin >> N >> P >> Q;
    int x;
    vector<double> slope;
    cout.precision(17);
    X.assign(N, {0, 0});
    for (size_t i = 0; i < N; i++)
    {
        cin >> x;
        X[i].first = x;
    }
    
    for (size_t i = 0; i < N; i++)
    {
        cin >> x;
        X[i].second = x;
        slope.push_back((double)((double)(x-P)/(double)X[i].first));
    }
    vector<double> slope2 = slope;
    for (size_t q = 0; q < Q; q++)
    {
        int Db; cin >> Db;
        vector<pair<int, int>> kkckm;
        int a, b;
        for (size_t i = 0; i < Db; i++)
        {
            cin >> a >> b;
            a--;
            kkckm.push_back({a, b});
            slope2[a] = (double)((double)(X[a].second+b-P)/(double)X[a].first);
        }
        cout << doCrap(slope2) << ' ';
        for (pair<int, int>& x : kkckm)
        {
            slope2[x.first] = slope[x.first];
        }
        
    }
}
Részfeladat Összpont Teszt Verdikt Idő Memória
base 10/45
1 Elfogadva 0/0 3ms 1684 KiB
2 Elfogadva 0/0 28ms 1956 KiB
3 Elfogadva 2/2 3ms 1936 KiB
4 Elfogadva 2/2 4ms 2068 KiB
5 Elfogadva 2/2 13ms 2572 KiB
6 Elfogadva 2/2 19ms 2536 KiB
7 Elfogadva 2/2 20ms 2624 KiB
8 Időlimit túllépés 0/4 365ms 2568 KiB
9 Időlimit túllépés 0/4 316ms 2828 KiB
10 Időlimit túllépés 0/4 360ms 2968 KiB
11 Időlimit túllépés 0/4 370ms 2948 KiB
12 Időlimit túllépés 0/4 356ms 3200 KiB
13 Időlimit túllépés 0/5 356ms 3392 KiB
14 Időlimit túllépés 0/5 375ms 3404 KiB
15 Időlimit túllépés 0/5 363ms 3668 KiB