#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char *argv[])
{
	int n, p;
	int ans = 0;
	vector<pair<int, int>> v;
	cin >> n >> p;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		//v.push_back(make_pair(a, b));
		
		bool isSame= false;
		if (!v.empty())
		{			
			for(int j=v.size()-1;j>=0;j--){
				auto now = v[j];
				//지금 입력한 프랫보다 
				//높은 프랫을 누르고 있는 상태면
				if(now.first==a){
					//그것을 때야한다
					if(now.second==b){
						isSame = true;
					}else if(now.second>b){
					    v.erase(v.begin() + j);
					    ans++;
					}
				}				
			}
			
			
		}
		if(isSame==false){
			  //새 프렛 누르기
			  v.push_back(make_pair(a,b));
			  ans++;
		}
	}
	
	cout << ans;
}

 

'프로그래밍 > C++' 카테고리의 다른 글

16197 두 동전 [C++]  (0) 2023.06.29
11404 플로이드 [c++]  (0) 2023.06.25
1181 단어 정렬 [c++]  (0) 2023.06.11
16928 뱀과 사다리 게임 [c++]  (0) 2023.06.09
함수, void 포인터  (0) 2023.04.26

+ Recent posts