145722025-01-17 07:53:34mártonágnesÁdám és Éva együttcpp17Wrong answer 8/5034ms944 KiB
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main()
{
    int p, dba, dbe, dbtalalka=0, x, y, a, e, l;
    map <int, int> talalka;
    cin >> p;
    cin >> dba;
    vector <int> idopA;
    for (int i=0; i<2*dba; i++)
    {
        cin >> a;
        idopA.insert (idopA.begin()+i, a);
    }
    cin >> dbe;
    vector <int> idopE;
    for (int j=0; j<2*dbe; j++)
    {
        cin >> e;
        idopE.insert (idopE.begin()+j, e);

    }
    if (dba==dbe)
    {
        for (int k=0; k<2*dba-1; k+=2)
        {
            l=k;
            if (idopA[k]>idopE[k])
            {
                x=idopA[k];
            }
            else x=idopE[k];
            if (idopA[k+1]>idopE[k+1])
            {
                y=idopE[k+1];
            }
            else y=idopA[k+1];
            if (x<y)
            {
                talalka[x]=y;
                dbtalalka++;
            }
            else
            {
                if (x>y)
                {
                    l=l-2;
                    if (idopA[k]>idopE[l])
                    {
                        x=idopA[k];
                    }
                    else x=idopE[l];
                    if (idopA[k+1]>idopE[l+1])
                    {
                        y=idopE[l+1];
                    }
                    else y=idopA[k+1];
                    if (x<y)
                    {
                        talalka[x]=y;
                        dbtalalka++;
                    }
                }
            }


        }
    }
    cout << dbtalalka<<endl;
    map <int, int>::iterator it=talalka.begin();
    while (it !=talalka.end())
    {
        cout << it ->first << " "<< it ->second << endl;
        ++it;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms508 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms376 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms508 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/21ms500 KiB
14Wrong answer0/21ms316 KiB
15Wrong answer0/21ms508 KiB
16Wrong answer0/232ms688 KiB
17Wrong answer0/330ms780 KiB
18Wrong answer0/328ms760 KiB
19Wrong answer0/429ms688 KiB
20Wrong answer0/434ms944 KiB
21Wrong answer0/432ms688 KiB
22Wrong answer0/432ms772 KiB