58462023-10-03 23:04:27mmatedKikötők (35 pont)cpp11Time limit exceeded 19/35273ms12256 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;
    pair<int,int> a[m];
    f(i,0,m)    cin>>a[i].first>>a[i].second;
    int x[n]={0};
    f(i,0,m)
    {
        f(j,0,n)
        {
            if(a[i].first <j && a[i].second > j)    x[j]+=2;
            else if(a[i].first==j || a[i].second==j)    x[j]++;
        }
    }
    int maxi=0;
    f(i,0,n)
    {
        if(x[maxi]<x[i])    maxi=i;
    }
    cout<<maxi<<" "<<x[maxi];

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base19/35
1Accepted0/03ms1888 KiB
2Time limit exceeded0/0254ms3696 KiB
3Accepted1/13ms3580 KiB
4Accepted1/13ms3788 KiB
5Accepted1/13ms3992 KiB
6Accepted1/13ms4360 KiB
7Accepted1/13ms4436 KiB
8Accepted2/23ms4528 KiB
9Accepted2/24ms4540 KiB
10Accepted2/28ms4568 KiB
11Accepted2/217ms4612 KiB
12Accepted2/221ms4784 KiB
13Accepted2/241ms5032 KiB
14Accepted2/2157ms5208 KiB
15Time limit exceeded0/2270ms4420 KiB
16Time limit exceeded0/2256ms6428 KiB
17Time limit exceeded0/2264ms7976 KiB
18Time limit exceeded0/2273ms7676 KiB
19Time limit exceeded0/2240ms7860 KiB
20Time limit exceeded0/2264ms9672 KiB
21Time limit exceeded0/2240ms10944 KiB
22Time limit exceeded0/2261ms12256 KiB