95332024-02-22 19:50:08Vkrisztian01Ádám és Éva együttpython3Runtime error 0/5018ms14136 KiB
#include <iostream>
#include<vector>

using namespace std;

vector<vector<int> > ki;

int main()
{
    int n,adam,eva,a,b,szamlalo=0;
    cin>>n;
    int* nums=new int[1000002];
    for(int i=0;i<=1000000;i++) nums[i]=0;
    cout<<nums[1000000];
    cin>>adam;
    while(adam--)
    {
        cin>>a>>b;
        ++nums[a];
        --nums[b];
    }
    cin>>eva;
    while(eva--)
    {
        cin>>a>>b;
        ++nums[a];
        --nums[b];
    }
    for(int i=1;i<=n;i++)
    {
        szamlalo+=nums[i];
        if(szamlalo==2 && nums[i]>0)
        {
            ki.push_back({i});
            continue;
        }
        if((szamlalo==1 && nums[i]==-1) || (szamlalo==0 && nums[i]==-2))
        {
            ki.back().push_back(i);
            continue;
        }
    }
    cout<<ki.size()<<"\n";
    for(auto x:ki) cout<<x[0]<<" "<<x[1]<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/018ms10880 KiB
2Runtime error0/017ms11208 KiB
3Runtime error0/217ms11504 KiB
4Runtime error0/217ms11776 KiB
5Runtime error0/217ms11588 KiB
6Runtime error0/217ms12036 KiB
7Runtime error0/217ms12312 KiB
8Runtime error0/217ms11992 KiB
9Runtime error0/217ms12288 KiB
10Runtime error0/217ms12528 KiB
11Runtime error0/217ms12924 KiB
12Runtime error0/217ms12828 KiB
13Runtime error0/217ms12804 KiB
14Runtime error0/217ms13376 KiB
15Runtime error0/217ms13132 KiB
16Runtime error0/217ms13100 KiB
17Runtime error0/317ms13248 KiB
18Runtime error0/317ms13528 KiB
19Runtime error0/417ms13852 KiB
20Runtime error0/417ms14064 KiB
21Runtime error0/417ms14136 KiB
22Runtime error0/417ms13816 KiB