46702023-03-30 20:07:29Erik_GepardÁdám és Éva együttcpp17Wrong answer 7/5016ms7040 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
#define int long long

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";
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
}
SubtaskSumTestVerdictTimeMemory
base7/50
1Accepted0/03ms1832 KiB
2Wrong answer0/03ms2180 KiB
3Accepted2/23ms2284 KiB
4Accepted2/23ms2452 KiB
5Partially correct1/23ms2664 KiB
6Accepted2/23ms2744 KiB
7Wrong answer0/23ms2936 KiB
8Wrong answer0/23ms3152 KiB
9Wrong answer0/23ms3360 KiB
10Wrong answer0/23ms3596 KiB
11Wrong answer0/23ms3860 KiB
12Wrong answer0/23ms3828 KiB
13Wrong answer0/23ms3928 KiB
14Wrong answer0/22ms4012 KiB
15Wrong answer0/22ms4264 KiB
16Wrong answer0/216ms6576 KiB
17Wrong answer0/316ms6448 KiB
18Wrong answer0/314ms6000 KiB
19Wrong answer0/414ms6432 KiB
20Wrong answer0/416ms6752 KiB
21Wrong answer0/416ms6884 KiB
22Wrong answer0/414ms7040 KiB