95452024-02-22 21:00:26Vkrisztian01Ádám és Éva együttcpp17Runtime error 0/5032ms65060 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.assign(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/029ms65060 KiB
2Runtime error0/027ms64812 KiB
3Runtime error0/226ms64540 KiB
4Runtime error0/228ms64312 KiB
5Runtime error0/228ms64104 KiB
6Runtime error0/228ms63892 KiB
7Runtime error0/228ms63884 KiB
8Runtime error0/227ms63728 KiB
9Runtime error0/228ms63640 KiB
10Runtime error0/228ms63652 KiB
11Runtime error0/228ms63576 KiB
12Runtime error0/228ms63508 KiB
13Runtime error0/228ms63492 KiB
14Runtime error0/228ms63256 KiB
15Runtime error0/228ms63252 KiB
16Runtime error0/228ms63248 KiB
17Runtime error0/328ms63220 KiB
18Runtime error0/328ms63208 KiB
19Runtime error0/430ms63000 KiB
20Runtime error0/428ms62996 KiB
21Runtime error0/432ms62776 KiB
22Runtime error0/432ms62512 KiB