174412025-07-16 16:32:36peti1234Particlescpp17Wrong answer 90/100717ms1220 KiB
#include <bits/stdc++.h>

using namespace std;
const int c=50005;
int n, k, t[c][2], v[c][2];
double l;
bool kesz[c][2];
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> l >> k;
    for (int j=0; j<2; j++) {
        for (int i=1; i<=n; i++) {
            cin >> t[i][j] >> v[i][j];
        }
    }
    for (int db=0; db<k; db++) {
        double lo=0, hi=2e9, mid;
        int pos[2]={0, 0};
        for (int it=0; it<36; it++) {
            double dist[2]={0, 0};
            mid=(hi+lo)/2;
            for (int j=0; j<2; j++) {
                for (int i=1; i<=n; i++) {
                    if (kesz[i][j]) continue;
                    double ert=(mid-t[i][j])*v[i][j];
                    if (ert>dist[j]) {
                        pos[j]=i;
                        dist[j]=ert;
                    }
                }
            }
            if (dist[0]+dist[1]>l) hi=mid;
            else lo=mid;
        }
        cout << pos[0] << " " << pos[1] << "\n";
        kesz[pos[0]][0]=1, kesz[pos[1]][1]=1;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask190/100
1Accepted5/51ms508 KiB
2Accepted5/52ms316 KiB
3Accepted5/53ms316 KiB
4Wrong answer0/57ms316 KiB
5Wrong answer0/59ms316 KiB
6Accepted5/514ms500 KiB
7Accepted5/5115ms588 KiB
8Accepted5/5163ms648 KiB
9Accepted5/5224ms720 KiB
10Accepted5/5310ms832 KiB
11Accepted5/5389ms820 KiB
12Accepted5/5449ms976 KiB
13Accepted5/5546ms1076 KiB
14Accepted5/5616ms1116 KiB
15Accepted5/5661ms1076 KiB
16Accepted5/5717ms1076 KiB
17Accepted5/5716ms1076 KiB
18Accepted5/5717ms1076 KiB
19Accepted5/5717ms1220 KiB
20Accepted5/5713ms1080 KiB