Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
193087 zjx1015 宝藏 C++ 解答错误 30 0 MS 252 KB 595 2025-05-06 19:03:42

Tests(3/10):


#include<bits/stdc++.h> using namespace std; int n,m,p; vector<pair<int,int>> v; vector<int> dp; bool cmp(pair<int,int> a,pair<int,int> b){ return a.first==b.first?a.second>b.second:a.first<b.first; } int main(){ scanf("%d%d%d",&n,&m,&p); int x,y; for(int i=0;i<p;i++){ scanf("%d%d",&x,&y); v.push_back({x,y}); } sort(v.begin(),v.end(),&cmp); for(auto num:v){ auto pos=upper_bound(dp.begin(),dp.end(),num.second); if(pos==dp.begin())dp.insert(dp.begin(),num.second); else *(pos-1)=num.second; } printf("%d",dp.size()); return 0; }


测评信息: