46392023-03-30 13:44:24Error42Kikötők (35 pont)cpp17Accepted 35/3568ms5036 KiB
#include <algorithm>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    vector<int> diff(n + 2);

    for (int i = 0; i < m; i++) {
        int s, e;
        cin >> s >> e;

        diff[s]++;
        diff[s + 1]++;
        diff[e]--;
        diff[e + 1]--;
    }

    vector<int> cnt(n + 2);

    partial_sum(diff.begin(), diff.end(), cnt.begin());

    auto it = max_element(cnt.begin(), cnt.end());

    cout << it - cnt.begin() << " " << *it << "\n";
}
SubtaskSumTestVerdictTimeMemory
base35/35
1Accepted0/03ms1808 KiB
2Accepted0/068ms3412 KiB
3Accepted1/13ms2272 KiB
4Accepted1/13ms2296 KiB
5Accepted1/12ms2296 KiB
6Accepted1/13ms2432 KiB
7Accepted1/13ms2648 KiB
8Accepted2/23ms2896 KiB
9Accepted2/23ms3084 KiB
10Accepted2/23ms3184 KiB
11Accepted2/24ms3308 KiB
12Accepted2/24ms3288 KiB
13Accepted2/24ms3584 KiB
14Accepted2/24ms3752 KiB
15Accepted2/26ms3828 KiB
16Accepted2/267ms4176 KiB
17Accepted2/267ms4304 KiB
18Accepted2/28ms4692 KiB
19Accepted2/28ms4692 KiB
20Accepted2/261ms4748 KiB
21Accepted2/268ms4952 KiB
22Accepted2/268ms5036 KiB