| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 3033 | 孙灏洋 | 摘红苹果 | C++ | Accepted | 100 | 0 MS | 256 KB | 670 | 2019-12-11 20:53:28 |
#include<iostream> using namespace std; int main(){ int n,m,apple=0; int a[101],b[5]; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ cin>>b[i]; } for(int i=1;i<n;i++){ for(int j=1;j<n-1;j++){ if(a[i]>a[i+1]){ int t=a[i]; a[i]=a[i+1]; a[i+1]=t; } } } for(int i=1;i<m;i++){ for(int j=1;j<n-1;j++){ if(b[i]>b[i+1]){ int t=b[i]; b[i]=b[i+1]; b[i+1]=t; } } } int k=1; for(int i=1;i<=m;i++){ int time=0; for(int j=k;j<=n;j++){ if(a[j]<=b[i]){ apple++; time++; k++; } if(time==2){ break; } } } cout<<apple; }