41342023-03-15 12:08:471478Kikötők (35 pont)cpp17Elfogadva 35/3521ms4888 KiB
#include <bits/stdc++.h>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin()                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main()
{
    fast_cin();
    //ifstream cin("in.txt");

    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<int> db(n + 2);
    for (int i = 1; i <= m; i++)
    {
        int a;
        cin >> a;
        int b;
        cin >> b;
        db[a]++;
        db[b + 1]--;
        db[a + 1]++;
        db[b]--;
    }
    int maxi = 0;
    int maxind;
    int a = 0;
    for (int i = 1; i <= n; i++)
    {
        a += db[i];
        if (a > maxi)
        {
            maxi = a;
            maxind = i;
        }
    }
    cout << maxind << " " << maxi;

    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base35/35
1Elfogadva0/03ms1832 KiB
2Elfogadva0/021ms2880 KiB
3Elfogadva1/13ms2228 KiB
4Elfogadva1/13ms2444 KiB
5Elfogadva1/12ms2532 KiB
6Elfogadva1/13ms2656 KiB
7Elfogadva1/13ms2740 KiB
8Elfogadva2/23ms2748 KiB
9Elfogadva2/23ms2880 KiB
10Elfogadva2/23ms2960 KiB
11Elfogadva2/23ms3304 KiB
12Elfogadva2/23ms3396 KiB
13Elfogadva2/23ms3308 KiB
14Elfogadva2/24ms3600 KiB
15Elfogadva2/24ms3776 KiB
16Elfogadva2/221ms3648 KiB
17Elfogadva2/221ms3792 KiB
18Elfogadva2/24ms3776 KiB
19Elfogadva2/24ms4444 KiB
20Elfogadva2/219ms4520 KiB
21Elfogadva2/221ms4888 KiB
22Elfogadva2/221ms4848 KiB