59072023-10-05 14:12:37mmatedKikötők (35 pont)cpp17Wrong answer 1/3526ms4732 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;

void solve()
{
    int n,m;
    cin>>n>>m;
    int a[n+1]={0};
    
    int x,y;
    f(i,0,m)
    {
        cin>>x>>y;
        a[x]++;         
        a[x+1]++;
        a[y]--;
    }
    int maxi=0;
    int maxp=0;
    int c=0;
    f(i,1,n+1)
    {
        c+=a[i];
        if(maxi<c)
        {
            maxi=c;
            maxp=i;
        }
    }
    cout<<maxp<<" "<<maxi;


}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/35
1Accepted0/03ms2036 KiB
2Wrong answer0/026ms2944 KiB
3Accepted1/12ms2176 KiB
4Wrong answer0/12ms2320 KiB
5Wrong answer0/13ms2448 KiB
6Wrong answer0/13ms2668 KiB
7Wrong answer0/13ms2876 KiB
8Wrong answer0/23ms3084 KiB
9Wrong answer0/23ms3120 KiB
10Wrong answer0/23ms3252 KiB
11Wrong answer0/23ms3476 KiB
12Wrong answer0/23ms3552 KiB
13Wrong answer0/23ms3648 KiB
14Wrong answer0/24ms3816 KiB
15Wrong answer0/24ms3908 KiB
16Wrong answer0/226ms3988 KiB
17Wrong answer0/226ms4228 KiB
18Wrong answer0/24ms4508 KiB
19Wrong answer0/24ms4332 KiB
20Wrong answer0/224ms4352 KiB
21Wrong answer0/226ms4644 KiB
22Wrong answer0/226ms4732 KiB