87552024-01-28 22:12:27AncsaMekk Mester munkái (50 pont)cpp17Wrong answer 7/5090ms9380 KiB
#include <bits/stdc++.h>

using namespace std;

/*
Be:
10 14
3 10
1 7
3 1
10 12
3 9
4 5
6 6
8 10
10 13
3 7



*/
typedef struct {
   int eleje, vege, sorszam;
}Tartam;



bool sorrend (Tartam egyik, Tartam masik )
{
    return (egyik.vege<masik.vege);
}

int main()
{
    int n, napok;
    cin>>n;  //megrendelesek
    cin>>napok; //a napok szama

    vector<Tartam> intervallum;
    Tartam uj;
    for(int i=1;i<=n;i++)
    {
        cin>> uj.eleje>>uj.vege;
        uj.sorszam=i;
        intervallum.push_back(uj);
    }
    cout<<endl;
    sort(intervallum.begin(),intervallum.end(),sorrend);

    vector <Tartam> mester;
    vector <Tartam> fia;
    int autolso=0, futolso=0;
    int i=0;
    int fszam=0, aszam=0;
    while (i<n)
    {
       Tartam x=intervallum.at(i);
       if (x.eleje>autolso)
       {
           mester.push_back(x);
           autolso=x.vege;
           aszam++;
       }
       else if (x.eleje>futolso)
       {
           fia.push_back(x);
           futolso=x.vege;
           fszam++;
       }
       i++;
    }
    cout<<aszam<<" "<<fszam<<endl;
        
    for(Tartam x:mester)
        cout << x.sorszam<< " ";
    cout<<endl;    
    for(Tartam x:fia)
        cout <<x.sorszam<< " ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1812 KiB
2Wrong answer0/09ms2580 KiB
3Accepted1/13ms2216 KiB
4Accepted1/13ms2464 KiB
5Wrong answer0/23ms2504 KiB
6Wrong answer0/23ms2640 KiB
7Accepted2/23ms2856 KiB
8Wrong answer0/23ms3064 KiB
9Accepted3/33ms3156 KiB
10Wrong answer0/14ms3552 KiB
11Wrong answer0/13ms3552 KiB
12Wrong answer0/23ms3652 KiB
13Wrong answer0/24ms3772 KiB
14Wrong answer0/23ms4000 KiB
15Wrong answer0/23ms4228 KiB
16Wrong answer0/33ms4288 KiB
17Wrong answer0/282ms7440 KiB
18Wrong answer0/282ms7432 KiB
19Wrong answer0/482ms7436 KiB
20Wrong answer0/482ms7568 KiB
21Wrong answer0/482ms7752 KiB
22Wrong answer0/482ms7716 KiB
23Wrong answer0/490ms9380 KiB