52042023-04-22 00:16:32SleepyOverlordKikötők (35 pont)cpp17Elfogadva 35/3586ms21760 KiB
#include <vector>
#include <string> 
#include <set> 
#include <map> 
#include <unordered_set>
#include <unordered_map>
#include <queue> 
#include <bitset> 
#include <stack>
#include <list>

#include <numeric> 
#include <algorithm> 
#include <random>
#include <chrono>

#include <cstdio>
#include <fstream>
#include <iostream> 
#include <sstream> 
#include <iomanip>
#include <climits>

#include <cctype>
#include <cmath> 
#include <ctime>
#include <cassert>

using namespace std;

#define ULL unsigned long long
#define LL long long
#define PII pair <int, int>
#define VB vector <bool>
#define VI vector <int>
#define VLL vector <LL>
#define VD vector <double>
#define VS vector <string>
#define VPII vector <pair <int, int> >
#define VVI vector < VI >
#define VVB vector < VB >
#define SI set < int >
#define USI unordered_set <int>
#define MII map <int, int>
#define UMII unordered_map <int, int>
#define MS multiset
#define US unordered_set
#define UM unordered_map
#define UMS unordered_multiset
#define UMM unordered_multimap

#define FORN(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)

#define SZ size()
#define BG begin() 
#define EN end() 
#define CL clear()
#define X first
#define Y second
#define RS resize
#define PB push_back
#define MP make_pair
#define ALL(x) x.begin(), x.end()
#define INS insert
#define ER erase
#define CNT count

int n, m;
VI a;

int main()
{
	cin >> n >> m;
	a.RS(n + 2);
	FOR(i, 1, m)
	{
		int x, y;
		cin >> x >> y;
		++a[x + 1];
		--a[y + 1];
		++a[x];
		--a[y];
	}
	set <PII> s;
	FOR(i, 2, n) 
	{
		a[i] += a[i - 1];
		s.INS({-a[i], i});
	}

	auto [cnt, ind] = *s.BG;
	cout << ind << " " << -cnt;

	return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base35/35
1Elfogadva0/03ms1808 KiB
2Elfogadva0/086ms13216 KiB
3Elfogadva1/13ms3744 KiB
4Elfogadva1/13ms3796 KiB
5Elfogadva1/13ms4012 KiB
6Elfogadva1/13ms4100 KiB
7Elfogadva1/13ms4232 KiB
8Elfogadva2/23ms4360 KiB
9Elfogadva2/23ms4656 KiB
10Elfogadva2/24ms5072 KiB
11Elfogadva2/24ms5112 KiB
12Elfogadva2/24ms5300 KiB
13Elfogadva2/26ms5852 KiB
14Elfogadva2/29ms6996 KiB
15Elfogadva2/212ms8060 KiB
16Elfogadva2/275ms11456 KiB
17Elfogadva2/281ms15004 KiB
18Elfogadva2/224ms16164 KiB
19Elfogadva2/227ms16828 KiB
20Elfogadva2/278ms18256 KiB
21Elfogadva2/286ms20512 KiB
22Elfogadva2/286ms21760 KiB