Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
133777 分发饼干 C++ 解答错误 0 0 MS 272 KB 509 2024-03-02 09:16:27

Tests(0/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--){ adds=*lower_bound(s+1,s+adds+1,g[i]); cout<<adds<<endl; if(adds) { cnt++; } } cout<<cnt; }


测评信息: