Submission

Status:

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

Subtask/Task Score:

{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}

Score: 100

User: dddrrrr

Problemset: ลอดสะพาน

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-17 09:07:26

#include <bits/stdc++.h>
using namespace std;

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cout.tie(0)->sync_with_stdio(0);
	
	int s ,n;
	cin >> s >> n;
	
	vector <pair <int ,int>> vec;
	for(int i=0 ;i<n ;i++){
		int x ,y;
		cin >> x >> y;
		vec.push_back({x ,1});
		vec.push_back({y ,-1});
	}
	
	sort(vec.begin() ,vec.end());
	
	int mx = 0 ,curr=0;
	for(int i=0 ;i<n+n ;i++){
		if(vec[i].second == 1)curr++;
		else curr--;
		
		mx = max(mx ,curr);
	}
	cout << mx;
	return 0;
}