85分,求dalao帮看看(必关)!!!
查看原帖
85分,求dalao帮看看(必关)!!!
1458127
panbaihua___楼主2025/7/24 21:29
#include<bits/stdc++.h>
using namespace std;
const int N=3e4+5;
int n;
int tot=0;
struct humen{
    int h;
    int w;
}a[N];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].h>>a[i].w;
    }
    for(int i=1;i<=n;i++){
        for(int j=1+i;j<=n;j++){
            if(a[i].h<a[j].h){
                swap(a[i],a[j]);
                tot++;
            }
            else if(a[i].h==a[j].h){
                if(a[i].w<a[j].w){
                    swap(a[i],a[j]);
                    tot++;
                }
            }
        }
    }
    cout<<tot;
    return 0;
}

qwq求求

2025/7/24 21:29
加载中...