108682024-04-17 09:03:15Leventusz09Particlescpp17Wrong answer 0/10081ms5044 KiB
#include <bits/stdc++.h>

//#define max(list_) (*max_element(begin(list_), end(list_)))
//#define min(list_) (*min_element(begin(list_), end(list_)))
//#define indexOf(list_, value) (*find(begin(list_), end(list_), value))

using namespace std;

int main(){
    int N, L, K;
    cin >> N;
    cin >> L;
    cin >> K;

    vector<float> EndX(N);
    vector<float> EndY(N);
    vector<int> IndX(N);
    vector<int> IndY(N);

    for(int i=0, t, v; i<N; i++){
            cin >> t;
            cin >> v;
            EndX[i] = (L/2 + v*t) / v;
            IndX[i] = i;
    }
    for(int i=0, t, v; i<N; i++){
            cin >> t;
            cin >> v;
            EndY[i] = (L/2 + v*t) / v;
            IndY[i] = i;
    }
    for(int i=0, mx, mxi, my, myi, n = N; i<K; i++, n--){
        mx = INT_MAX;
        mxi = 0;
        for(int j=0; j<n; j++){
            if(EndX[j] < mx) mx = EndX[j], mxi = IndX[j];
            //cout << EndX[j] << ";";
        }
        my = INT_MAX;
        myi = 0;
        for(int j=0; j<n; j++){
            if(EndY[j] < my) my = EndY[j], myi = IndY[j];
            //cout << EndY[j] << ",";
        }
        cout << mxi + 1 << " " << myi + 1 << endl;
        EndX.erase(EndX.begin() + mxi);
        IndX.erase(IndX.begin() + mxi);
        EndY.erase(EndY.begin() + myi);
        IndY.erase(IndY.begin() + myi);
    }

    /*vector<int> Tx(N);
    vector<int> Ty(N);
    vector<int> Vx(N);
    vector<int> Vy(N);
    vector<float> Px(N);
    vector<float> Py(N);*/

    //vector<vector<float>> Matrix(N, vector<float>(N));
    /*vector<float> List(0);
    vector<vector<int>> Index(0, vector<int>(2));
    vector<int> tv(2);

    for(int i=0; i<N; i++){
        cin >> Tx[i];
        cin >> Vx[i];
    }
    float minV = INT_MAX;
    int Xi = -1, Yi = -1;
    for(int i=0, j, temp; i<N; i++){
        cin >> Ty[i];
        cin >> Vy[i];
        for(j=0; j<N; j++){
            temp = (Vx[i]*Tx[i] - Vy[j]*Ty[j])/(Vx[i] - Vy[j]);
            if(temp <= 0 || temp >= L){
                if(temp < minV) minV = temp, Xi = i, Yi = j;
                List.push_back(temp);
                tv[0] = i;
                tv[1] = j;
                Index.push_back(tv);
            }
        }
    }

    /*for(int i=0, j, temp; i<N; i++){
    }*//*
    for(int i=0, l=0; l<K; i+=0){
        if(true /*List[i, 0] != -1*//*){
            cout << List[i, 0] + 1 << " " << List[i, 1] << endl;
            l++;
            for(int j=0; j<List.size(); j++){
                if(List[j, 0] == List[i, 0]) List.erase(List.begin() + j), j--;
                if(List[j, 1] == List[i, 1]) List.erase(List.begin() + j), j--;
            }
        }
    }*/


    /*for(int i=0; i<N; i++){
        cin >> Tx[i];
        cin >> Vx[i];
        Px[i] = Vx[i] * -Tx[i];
    }
    for(int i=0; i<N; i++){
        cin >> Ty[i];
        cin >> Vy[i];
        Py[i] = L + Vy[i] * Ty[i];
    }

    int l = 0;

    int Xm = 0;
    int Ym = L;
    int Xmi = 0;
    int Ymi = 0;
    for(float i=0, d = 0.01; l<K; i+=d){
        if(Xm >= Ym){
            l++;
            cout << Xmi + 1 << " " << Ymi + 1 << endl;

            Px[Xmi] = INT_MIN;
            Vx[Xmi] = 0;
            Py[Ymi] = INT_MAX;
            Vy[Ymi] = 0;
        }
        Xm = INT_MIN; Ym = INT_MAX;
        Xmi = -1; Ymi = -1;
        for(int j=0; j<N; j++){
            Px[j] += Vx[j]*d;
            if(Px[j] > Xm) Xm = Px[j], Xmi = j;
            Py[j] -= Vy[j]*d;
            if(Py[j] < Ym) Ym = Py[j], Ymi = j;
        }
    }*/
}
SubtaskSumTestVerdictTimeMemory
subtask10/100
1Wrong answer0/53ms1816 KiB
2Wrong answer0/53ms2060 KiB
3Wrong answer0/53ms2304 KiB
4Wrong answer0/53ms2512 KiB
5Wrong answer0/54ms2792 KiB
6Wrong answer0/54ms2892 KiB
7Runtime error0/516ms3308 KiB
8Runtime error0/523ms3720 KiB
9Runtime error0/528ms3780 KiB
10Runtime error0/539ms4000 KiB
11Runtime error0/546ms4476 KiB
12Wrong answer0/554ms4460 KiB
13Wrong answer0/563ms4744 KiB
14Wrong answer0/568ms4828 KiB
15Wrong answer0/574ms4832 KiB
16Wrong answer0/579ms4960 KiB
17Wrong answer0/579ms5044 KiB
18Wrong answer0/581ms4956 KiB
19Wrong answer0/579ms4956 KiB
20Wrong answer0/579ms4960 KiB