d055. P-4-14. 控制點 (2D-max) - TCFSH CIRC Judge

本文最後更新於:2024年1月12日 下午

d055. P-4-14. 控制點 (2D-max) - TCFSH CIRC Judge

AP325-d055.cpp

// Author : ysh
// 08/03/2022 Wed 10:06:43
// https://judge.tcirc.tw/ShowProblem?problemid=d055
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;cin>>n;
    vector<pair<int,int>>f(n);
    for(int i = 0;i<n;i++) {
        cin>>f[i].first;
    }
    for(int i = 0;i<n;i++) {
        cin>>f[i].second;
    }
    sort(f.begin(),f.end(),[] (pair<int,int>a,pair<int,int>b) {
        if(a.first != b.first) return a.first > b.first;
        return a.second > b.second;
    });
    int mmax = 0;
    int ans = 0;
    for(auto i : f) {
        if(i.second > mmax) {
            mmax = i.second;
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

d055. P-4-14. 控制點 (2D-max) - TCFSH CIRC Judge
http://mysh212.github.io/algosolution/AP325-d055.cpp/
作者
ysh
發布於
2022年8月3日
更新於
2024年1月12日
許可協議