Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133911 | baim. | 分发饼干 | C++ | 编译错误 | 0 | 0 MS | 0 KB | 716 | 2024-03-02 10:31:22 |
#include<bits/stdc++.h> using namespace std; int findContentChildren(vector<int>g,vector<int>s) { sort(g.begin(), g.end()); sort(s.begin(), s.end()); int m = g.size(), n = s.size(); int count = 0; for (int i = 0, j = 0; i < m && j < n; i++, j++) { while (j < n && g[i] > s[j]) { j++; } if (j < n) { count++; } } return count; } int main(){ int a,b; cin>>a; int c[1001],d[1001]; for(int i=1;i<=a;i++){ cin>>c[i]; } cin>>b; for(int i=1;i<=a;i++){ cin>>d[i]; } cout<<findContentChildren(c,d); }