对所有计算机按照内存容量大小从大到小排序,然后顺序检索,看有没有下克上容量小但是速度超快的,有的话就更新最大基准值,没有的话就完爆数量+1。
所有的做法都是错的,建议牛客加强数据重判。
#include <bits/stdc++.h>
#define sc(x) scanf("%lld", &(x))
#define pr(x) printf("%lld", (x))
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
struct lap {
ll a, b;
} p[N];
bool cmp(lap x, lap y) { return x.a > y.a; }
int main() {
ll n;
sc(n);
for (ll i = 0; i < n; ++i) sc(p[i].a), sc(p[i].b);
sort(p, p + n, cmp);
ll mx = p[0].b, ans = 0;
for (ll i = 1; i < n; ++i)
if (p[i].b <= mx) ++ans;
else mx = p[i].b;
pr(ans);
return 0;
} 
京公网安备 11010502036488号