83782024-01-15 11:06:07MrChipserMekk Mester munkái (50 pont)cpp11Wrong answer 0/50699ms4880 KiB
#include <iostream>

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;
    }*/

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1752 KiB
2Wrong answer0/0323ms2156 KiB
3Wrong answer0/13ms2124 KiB
4Wrong answer0/13ms2204 KiB
5Wrong answer0/23ms2332 KiB
6Wrong answer0/23ms2404 KiB
7Wrong answer0/23ms2556 KiB
8Wrong answer0/23ms2680 KiB
9Wrong answer0/33ms2884 KiB
10Wrong answer0/16ms3108 KiB
11Wrong answer0/16ms3324 KiB
12Wrong answer0/26ms3556 KiB
13Wrong answer0/26ms3916 KiB
14Wrong answer0/26ms3792 KiB
15Wrong answer0/26ms3896 KiB
16Wrong answer0/34ms3976 KiB
17Time limit exceeded0/2699ms4320 KiB
18Time limit exceeded0/2654ms4392 KiB
19Time limit exceeded0/4662ms4468 KiB
20Time limit exceeded0/4666ms4492 KiB
21Time limit exceeded0/4649ms4660 KiB
22Time limit exceeded0/4657ms4880 KiB
23Time limit exceeded0/4653ms4752 KiB