139742025-01-09 13:18:37BencuA lehető legkevesebb átszállás (50 pont)cpp17Wrong answer 2/5079ms652 KiB
#include <bits/stdc++.h>

using namespace std;
int n,m,s,M[10001],h;
struct vonatok {
    int x;
    int y;
    int szam;
}a[10001];
int helyre(int elso, int utolso) {
    int i=elso,j=utolso,p=elso;
    while (i<j) {
        if(a[i].x>a[j].x) {
            swap(a[i],a[j]);
            if(i==p) {
                p=j;
                i++;
            }
            else {
                p=i;
                j--;
            }
        }
        else if(p==i) j--;
            else i++;
    }
    return p;
}
void QuickSort(int elso,int utolso) {
    if (elso<utolso) {
        int k=helyre(elso,utolso);
        QuickSort(elso,k-1);
        QuickSort(k+1,utolso);
    }
}
void be() {
    ifstream f("be.in");
    cin>>n>>m;
    for (int i=1; i<=n; i++) {
        a[i].szam=i;
        cin>>a[i].x>>a[i].y;
    }
    QuickSort(1,n);
}

int main()
{
    be();
    cout<<-1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/01ms508 KiB
2Wrong answer0/079ms520 KiB
3Accepted1/11ms316 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/22ms316 KiB
8Wrong answer0/23ms316 KiB
9Wrong answer0/24ms428 KiB
10Wrong answer0/28ms316 KiB
11Wrong answer0/214ms500 KiB
12Wrong answer0/221ms512 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/24ms316 KiB
15Wrong answer0/28ms500 KiB
16Wrong answer0/221ms460 KiB
17Wrong answer0/241ms480 KiB
18Wrong answer0/252ms492 KiB
19Wrong answer0/261ms504 KiB
20Wrong answer0/264ms504 KiB
21Wrong answer0/278ms516 KiB
22Wrong answer0/279ms520 KiB
23Wrong answer0/279ms316 KiB
24Wrong answer0/279ms516 KiB
25Wrong answer0/279ms316 KiB
26Wrong answer0/279ms652 KiB
27Wrong answer0/279ms516 KiB
28Wrong answer0/279ms316 KiB