Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created June 17, 2023 02:01
Show Gist options
  • Save estelabn/0773f60875fa9c5c0b76b0a3a597918d to your computer and use it in GitHub Desktop.
Save estelabn/0773f60875fa9c5c0b76b0a3a597918d to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int estoque[n+3];
for(int i=1; i<=n; i++) cin >> estoque[i];
int p; cin >> p;
int res = 0;
for(int j=0; j<p; j++){
int i; cin >> i;
if(estoque[i] > 0){
res++;
estoque[i]--;
}
}
cout << res << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment