Created
June 17, 2023 02:01
-
-
Save estelabn/0773f60875fa9c5c0b76b0a3a597918d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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