46692023-03-30 20:05:30Erik_GepardÁdám és Éva együttcpp17Wrong answer 7/5016ms5596 KiB
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int, int>
#define se second
#define fi first
#define pb push_back
#define mp make_pair

void solve(){
    int p;
    cin>>p;
    int n, m;
    cin>>n;
    vector<pair<int, int> > a(n);
    for(pair<int, int> &x : a) cin>>x.fi>>x.se;
    cin>>m;
    vector<pii> b(m);
    for(pair<int, int> &x : b) cin>>x.fi>>x.se;
    int i=0, j=0;
    vector<pii> ans;
    while(i<n && j<m){
        if(a[i].fi<=b[j].fi){
            if(b[j].fi<a[i].se){
                ans.pb(mp(b[j].fi, a[i].se));
            }
            i++;
        }
        else{
            if(a[i].fi<b[j].se){
                ans.pb(mp(a[i].fi, b[j].se));
            }
            j++;
        }
    }
    cout<<ans.size()<<"\n";
    for(pii x : ans) cout<<x.first<<" "<<x.second<<"\n";
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1976 KiB
2Wrong answer0/03ms2104 KiB
3Accepted2/23ms2316 KiB
4Accepted2/22ms2528 KiB
5Partially correct1/22ms2572 KiB
6Accepted2/22ms2496 KiB
7Wrong answer0/23ms2624 KiB
8Wrong answer0/23ms2988 KiB
9Wrong answer0/23ms3056 KiB
10Wrong answer0/23ms3192 KiB
11Wrong answer0/22ms3284 KiB
12Wrong answer0/23ms3432 KiB
13Wrong answer0/23ms3344 KiB
14Wrong answer0/23ms3616 KiB
15Wrong answer0/23ms3492 KiB
16Wrong answer0/214ms4828 KiB
17Wrong answer0/314ms5032 KiB
18Wrong answer0/314ms4920 KiB
19Wrong answer0/414ms5188 KiB
20Wrong answer0/416ms5596 KiB
21Wrong answer0/414ms5508 KiB
22Wrong answer0/414ms5504 KiB