Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
133771 分发饼干 C++ 解答错误 33 0 MS 276 KB 488 2024-03-02 09:13:29

Tests(1/3):


#include <bits/stdc++.h> using namespace std; #define start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) int G,S,g[300010],s[300010],adds; int cmp(int x,int y){ return x<y; } int main(){ start; cin>>G; for(int i=1;i<=G;i++) cin>>g[i]; cin>>S; for(int i=1;i<=S;i++) cin>>s[i]; sort(g+1,g+G+1,cmp); sort(s+1,s+S+1,cmp); adds=S+1; int cnt=0; for(int i=G;i>=1;i--){ *lower_bound(s+1,s+adds+1,g[i])=adds; if(adds) { cnt++; } } cout<<cnt; }


测评信息: