95422024-02-22 20:55:44Vkrisztian01Ádám és Éva együttcpp17Runtime error 0/5034ms64980 KiB
#include <iostream>
#include<vector>
#include<map>

using namespace std;

int const c=100000;
int n,adam,eva,a,b,szamlalo=0;
vector<vector<int> > nums;
vector<vector<int> > ki;

int main()
{
    cin>>n;
    nums.resize(100,vector<int>(100001,0));
    cin>>adam;
    while(adam--)
    {
        cin>>a>>b;
        nums[a/c][a%(c+1)]++;
        nums[b/c][b%(c+1)]--;
    }
    cin>>adam;
    while(adam--)
    {
        cin>>a>>b;
        nums[a/c][a%(c+1)]++;
        nums[b/c][b%(c+1)]--;
    }
    for(int i=0;i*c<=n;i++)
    {
        for(int j=1;j<=c;j++)
        {
            szamlalo+=nums[i][j];
            if(szamlalo==2 && nums[i][j]>0)
            {
               ki.push_back({i*c+j});
               continue;
            }
            if((szamlalo==1 && nums[i][j]==-1) || (szamlalo==0 && nums[i][j]==-2))
            {
                ki.back().push_back(i*c+j);
                continue;
            }
        }
    }
    cout<<ki.size()<<"\n";
    for(auto x:ki) cout<<x[0]<<" "<<x[1]<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/029ms64980 KiB
2Runtime error0/027ms64764 KiB
3Runtime error0/227ms64520 KiB
4Runtime error0/226ms64332 KiB
5Runtime error0/228ms64324 KiB
6Runtime error0/234ms64084 KiB
7Runtime error0/228ms63940 KiB
8Runtime error0/232ms63700 KiB
9Runtime error0/228ms63700 KiB
10Runtime error0/228ms63468 KiB
11Runtime error0/228ms63460 KiB
12Runtime error0/228ms63284 KiB
13Runtime error0/234ms63056 KiB
14Runtime error0/234ms63024 KiB
15Runtime error0/232ms62804 KiB
16Runtime error0/228ms62796 KiB
17Runtime error0/332ms62788 KiB
18Runtime error0/330ms62564 KiB
19Runtime error0/429ms62540 KiB
20Runtime error0/428ms62364 KiB
21Runtime error0/428ms62132 KiB
22Runtime error0/427ms62148 KiB