108832024-04-17 18:49:07csicsilla70Particlescpp17Wrong answer 0/1002.081s3696 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int N, L, K;
    cin >> N;
    cin >> L;
    cin >> K;
 
    vector<int> Vx(N);
    vector<int> Vy(N);
    vector<int> Tx(N);
    vector<int> Ty(N);
    vector<float> I(0); // Ütközés dátumok
    float t = 0; //temporary
    vector<int> Ix(0);  // Ütköző indexek
    vector<int> Iy(0);
 
    for(int i=0; i<N; i++){
        cin >> Tx[i];
        cin >> Vx[i];
    }
    for(int i=0; i<N; i++){
        cin >> Ty[i];
        cin >> Vy[i];
 
        for(int j=0; j<N; j++){
            t = float(L + Vx[j]*Tx[j] + Vy[i]*Ty[i])/(Vx[j]+Vy[i]);
            if(0 < Vx[j] * (t - Tx[j]) && Vx[j] * (t-Tx[j]) < 100){
                I.push_back(float(t));
                Ix.push_back(j);
                Iy.push_back(i);
            }
        }
    }
    int mTi = -1;
    for(int i=0, j; i<K; i++){
        for(j=0; mTi!= -1 && j<I.size(); j++){
            if((Ix[j] == Ix[mTi] || Iy[j] == Iy[mTi]) && mTi != j){
                I.erase(I.begin() + j);
                Ix.erase(Ix.begin() + j);
                Iy.erase(Iy.begin() + j);
                j--;
                if(mTi > j) mTi--;
            }
        }
        if(mTi != -1){
            I.erase(I.begin() + mTi);
            Ix.erase(Ix.begin() + mTi);
            Iy.erase(Iy.begin() + mTi);
        }
        mTi = -1;
 
        for(j=0; j<I.size(); j++) if(I[j] < (mTi==-1?INT_MAX:I[mTi]) )  mTi = j;
        cout << Ix[mTi]+1 << " " << Iy[mTi]+1 << endl;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/100
1Wrong answer0/53ms1928 KiB
2Wrong answer0/53ms2072 KiB
3Wrong answer0/53ms2100 KiB
4Wrong answer0/54ms2232 KiB
5Wrong answer0/56ms2368 KiB
6Wrong answer0/59ms2456 KiB
7Wrong answer0/5492ms2856 KiB
8Runtime error0/5940ms3040 KiB
9Wrong answer0/51.735s3348 KiB
10Time limit exceeded0/52.065s2612 KiB
11Time limit exceeded0/52.081s2724 KiB
12Time limit exceeded0/52.076s3228 KiB
13Time limit exceeded0/52.069s3272 KiB
14Time limit exceeded0/52.058s3372 KiB
15Time limit exceeded0/52.052s3424 KiB
16Time limit exceeded0/52.065s3424 KiB
17Time limit exceeded0/52.065s3436 KiB
18Time limit exceeded0/52.062s3564 KiB
19Time limit exceeded0/52.053s3484 KiB
20Time limit exceeded0/52.056s3696 KiB