Submission

Status:

[PP][PP][PP][PP][PP][PP][PP][PP][PP][PP]

Score: 100

User: hmmm

Problemset: ลอดสะพาน

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-06 22:40:12

#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> p;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int l,n;
	cin >> l >> n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin >> x >> y;
		p.push_back({x,1});
		p.push_back({y,-1});
	}
	sort(p.begin(),p.end());
	int mx=0,cnt=0;
	for(auto e:p){
		int x=e.first;
		int y=e.second;
		cnt+=y;
		mx=max(mx,cnt);
	}
	cout << mx;
}