46012023-03-30 11:02:21AblablablaÁdám és Éva együttcpp17Wrong answer 27/5017ms5800 KiB
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, a;
    cin >> n >> a;

    vector<pii> adam(a, {0, 0});
    for(int i = 0; i < a; i++){
        cin >> adam[i].first >> adam[i].second;
    }

    int e;
    cin >> e;
    vector<pii> eva(e, {0, 0});
    for(int i = 0; i < e; i++){
        cin >> eva[i].first >> eva[i].second;
    }

    int adamInd = 0;
    int evaInd = 0;
    vector<pii> valaszok;
    while(adamInd < a && evaInd < e){
        if(adam[adamInd].first < eva[evaInd].first && adam[adamInd].second > eva[evaInd].first){
            valaszok.push_back(pii(eva[evaInd].first, min(eva[evaInd].second, adam[adamInd].second)));
            if(eva[evaInd].second < adam[adamInd].second){
                evaInd++;
            } else{
                adamInd++;
            }
        } else if(eva[evaInd].first < adam[adamInd].first && eva[evaInd].second > adam[adamInd].first){
            valaszok.push_back(pii(adam[adamInd].first, min(adam[adamInd].second, eva[evaInd].second)));
            if(eva[evaInd].second < adam[adamInd].second){
                evaInd++;
            } else{
                adamInd++;
            }
        } else if(eva[evaInd].second < adam[adamInd].first){
            evaInd++;
        } else{
            adamInd++;
        }
    }

    cout << valaszok.size() << "\n";
    for(pii x : valaszok){
        cout << x.first << " " << x.second << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base27/50
1Accepted0/03ms1828 KiB
2Accepted0/03ms2016 KiB
3Accepted2/23ms2232 KiB
4Accepted2/23ms2464 KiB
5Accepted2/23ms2680 KiB
6Accepted2/23ms2740 KiB
7Accepted2/23ms2872 KiB
8Accepted2/23ms2972 KiB
9Accepted2/23ms3176 KiB
10Wrong answer0/23ms3396 KiB
11Accepted2/23ms3620 KiB
12Accepted2/22ms3700 KiB
13Accepted2/23ms3832 KiB
14Accepted2/23ms3896 KiB
15Accepted2/22ms3900 KiB
16Wrong answer0/216ms5368 KiB
17Accepted3/316ms5376 KiB
18Wrong answer0/314ms5376 KiB
19Wrong answer0/416ms5380 KiB
20Wrong answer0/417ms5620 KiB
21Wrong answer0/416ms5544 KiB
22Wrong answer0/416ms5800 KiB