a194. 死亡 FLAG - 高中生程式解題系統

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

Zerojudge
解題紀錄

a194. 死亡 FLAG - 高中生程式解題系統

Zerojudge-a194.cpp

// Author : ysh
// 08/25/2022 Thu 21:45:19.09
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while(cin>>n) {
        vector<int>f;
        for(int i = 0;i<n;i++) {
            int tmp;cin>>tmp;
            auto found = lower_bound(f.rbegin(),f.rend(),tmp);
            if(found == f.rbegin()) {
                f.push_back(tmp);
            } else {
                *prev(found) = tmp;
            }
        }
        cout<<f.size()<<"\n";
    }
    return 0;
}

a194. 死亡 FLAG - 高中生程式解題系統
http://mysh212.github.io/algosolution/Zerojudge-a194.cpp/
作者
ysh
發布於
2022年8月25日
更新於
2024年1月12日
許可協議