83812024-01-15 11:12:57MrChipserMekk Mester munkái (50 pont)cpp11Wrong answer 7/50685ms4072 KiB
#include <iostream>
#include <vector>
using namespace std;
struct munka
{
    int k;
    int v;
    int s;
};
munka m[100000];
int n,h;
bool sorted()
{
    for(int i = 0; i < n-1; i++)
    {
        if(m[i].v>m[i+1].v)
            return false;
    }
    return true;
}
int main()
{
    cin >> n >> h;
    for(int i = 0; i < n; i++)
    {
        cin >> m[i].k >> m[i].v;
        m[i].s=i+1;
    }
    while(!sorted())
    {
        for(int i = 0; i < n-1; i++)
        {
            if(m[i].v>m[i+1].v)
            {
                int a = m[i].v;
                m[i].v=m[i+1].v;
                m[i+1].v=a;
                a=m[i].k;
                m[i].k=m[i+1].k;
                m[i+1].k=a;
                a=m[i].s;
                m[i].s=m[i+1].s;
                m[i+1].s=a;
            }
        }
    }
    /*for(int i = 0; i < n; i++)
    {
        cout << m[i].s << " " << m[i].k << " " << m[i].v << endl;
    }*/
    int mekk = 0;
    int fia = 0;
    vector<int> mekkm;
    vector<int> fiam;
    for(int i = 0; i < n; i++)
    {
        if(m[i].k>mekk)
        {
            mekkm.push_back(m[i].s);
            mekk=m[i].v;

        }
        else if(m[i].k>fia)
        {
            fiam.push_back(m[i].s);
            fia=m[i].v;
        }
    }
    cout << mekkm.size() << " " << fiam.size() << endl;
    for(int i = 0; i < mekkm.size(); i++)
        cout << mekkm[i] << " ";
    cout << endl;
    for(int i = 0; i < fiam.size(); i++)
        cout << fiam[i] << " ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1816 KiB
2Wrong answer0/0254ms2296 KiB
3Accepted1/13ms2292 KiB
4Accepted1/13ms2432 KiB
5Wrong answer0/23ms2544 KiB
6Wrong answer0/23ms2644 KiB
7Accepted2/23ms2732 KiB
8Wrong answer0/23ms2724 KiB
9Accepted3/33ms2852 KiB
10Wrong answer0/14ms2952 KiB
11Wrong answer0/14ms3080 KiB
12Wrong answer0/24ms3164 KiB
13Wrong answer0/24ms3164 KiB
14Wrong answer0/24ms3164 KiB
15Wrong answer0/24ms3168 KiB
16Wrong answer0/34ms3164 KiB
17Time limit exceeded0/2654ms3584 KiB
18Time limit exceeded0/2685ms3524 KiB
19Time limit exceeded0/4634ms3712 KiB
20Time limit exceeded0/4638ms3848 KiB
21Time limit exceeded0/4657ms4072 KiB
22Time limit exceeded0/4625ms4032 KiB
23Time limit exceeded0/4662ms4008 KiB