122652024-12-10 20:25:03feheristvanMekk Mester munkái (50 pont)cpp17Wrong answer 7/50686ms1424 KiB
#include <iostream>
#include <fstream>

using namespace std;

struct elem{

    int kezd, veg, index;

};

void be(int &n, int &h, elem a[])
{
   // ifstream fin("szoveg.in");
    cin >> n >> h;
    for(int i=0;i<n;i++)
    {
        cin >> a[i].kezd >> a[i].veg;
        a[i].index=i+1;
    }
   // fin.close();
}
void buborek(int n, elem a[])
{
    int csere=n-1,akt_csere;
    do{
            akt_csere=0;
            for(int i=0;i<csere;i++)
            {
                if(a[i].veg>a[i+1].veg)
                {
                    swap(a[i],a[i+1]);
                    akt_csere=i;
                }

            }
          csere=akt_csere;

    }while(csere!=0);
}
void kiir(int n, elem a[])
{
   // ofstream fout("szoveg.out");
   int vege_apa=a[0].veg;
   int vege_fia = a[1].veg;
   int apa[100000], fia[100000], db_a = 1, db_f = 1;
   apa[0] = a[0].index;
   fia[0] = a[1].index;
   for(int i=2;i<n;i++)
   {
       if(a[i].kezd > vege_apa)
       {
            vege_apa=a[i].veg;
            apa[db_a] = a[i].index;
            db_a ++;
       } else if(a[i].kezd > vege_fia){
            vege_fia = a[i].veg;
            fia[db_f] = a[i].index;
            db_f ++;
       }
   }
   cout << db_a <<  " " << db_f << endl;
   for(int i = 0; i < db_a; i ++){
        cout << apa[i] << " ";
   }
   cout << endl;
   for(int i = 0; i < db_f; i ++){
        cout << fia[i] << " ";
   }
  // fout.close();

}
int main()
{
    int n,h;
    elem  a[100000];
    be(n,h,a);
    buborek(n,a);
    kiir(n,a);
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/01ms320 KiB
2Wrong answer0/0223ms320 KiB
3Accepted1/11ms320 KiB
4Accepted1/11ms320 KiB
5Wrong answer0/21ms320 KiB
6Wrong answer0/21ms320 KiB
7Accepted2/21ms320 KiB
8Wrong answer0/21ms320 KiB
9Accepted3/31ms384 KiB
10Wrong answer0/13ms424 KiB
11Wrong answer0/13ms320 KiB
12Wrong answer0/23ms320 KiB
13Wrong answer0/23ms320 KiB
14Wrong answer0/23ms412 KiB
15Wrong answer0/23ms320 KiB
16Wrong answer0/32ms320 KiB
17Time limit exceeded0/2680ms1336 KiB
18Time limit exceeded0/2681ms1336 KiB
19Time limit exceeded0/4683ms1336 KiB
20Time limit exceeded0/4686ms1336 KiB
21Time limit exceeded0/4685ms1424 KiB
22Time limit exceeded0/4685ms1316 KiB
23Time limit exceeded0/4686ms1336 KiB