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

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base13/35
1Accepted0/03ms1768 KiB
2Time limit exceeded0/0273ms2204 KiB
3Accepted1/13ms2140 KiB
4Accepted1/13ms2352 KiB
5Wrong answer0/13ms2560 KiB
6Accepted1/12ms2644 KiB
7Wrong answer0/13ms2776 KiB
8Wrong answer0/23ms2992 KiB
9Accepted2/23ms3208 KiB
10Wrong answer0/24ms3560 KiB
11Accepted2/26ms3528 KiB
12Accepted2/27ms3800 KiB
13Accepted2/29ms3752 KiB
14Wrong answer0/234ms3984 KiB
15Accepted2/257ms4156 KiB
16Time limit exceeded0/2250ms4164 KiB
17Time limit exceeded0/2232ms4136 KiB
18Time limit exceeded0/2208ms4664 KiB
19Time limit exceeded0/2268ms3608 KiB
20Time limit exceeded0/2248ms4136 KiB
21Time limit exceeded0/2264ms4404 KiB
22Time limit exceeded0/2273ms4488 KiB