Submission

Status:

[P][P][P][P][P][PPPPPPPP]

Subtask/Task Score:

{17/17}{17/17}{17/17}{17/17}{17/17}{17/17}

Score: 100

User: Bestzu

Problemset: ขายรถยนต์

Language: cpp

Time: 0.026 second

Submitted On: 2025-10-17 11:35:27

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;


void display(vector<int> &a) {
	for(auto &e : a) {
		cout << e << " ";
	}
	cout << endl;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);

	int n; cin >> n;
	vector<pair<int,int>> car;
	for(int i = 0; i < n; i++) {
		int price, eff; cin >> price >> eff;
		car.push_back({price, eff});
	}
	int cnt = 0;
	int mx = 0;
	for(int i = n-1; i >= 0; i--) {
		if(mx < car[i].second) {
			mx = car[i].second;
		}
		else {
			cnt++;
		}
	}
	cout << cnt;
    return 0;
}