Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #define print(var) cout << #var << ": " << var<< endl;
- using namespace std;
- const int fzs = 1000001;
- int feetSizes[fzs];
- int main() {
- int tests;
- cin >> tests;
- for (int test = 0; test < tests; test++) {
- int shoesCount;
- int feetCount;
- cin >> shoesCount;
- cin >> feetCount;
- print(shoesCount);
- print(feetCount);
- const int lastSize = 50;
- int shoes[lastSize];
- for (int i = 20; i < 50; i++) {
- shoes[i] = 0;
- }
- for (int i = 0; i < shoesCount; i++) {
- int shoeSize;
- cin >> shoeSize;
- shoes[shoeSize]++;
- }
- for (int i = 0; i < feetCount; i++) {
- cin >> feetSizes[i];
- }
- sort(feetSizes, feetSizes + feetCount);
- int skiers = 0;
- for (int i = 0; i < feetCount; i++) {
- if (shoes[feetSizes[i]]) {
- skiers++;
- shoes[feetSizes[i]]--;
- //cout << skiers << " : " << shoes[feetSizes[i]] << endl;
- feetSizes[i] = 0;
- }
- }
- cout << skiers << endl;
- for (int i = 20; i < 50; i++) {
- cout << i << " : " << shoes[i] << endl;
- }
- for (int i = 0; i < feetCount; i++) {
- cout << i << " : " << feetSizes[i] << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment