Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using String = std::string;
- // Check Examples
- //Compiler version g++ 6.3.0
- struct Shoe
- {
- unsigned short size;
- unsigned char orientation;
- bool paired = false;
- Shoe()
- {
- std::cin >> size;
- std::cin >> orientation;
- if(size >= 100) size = 99;
- }
- bool operator==(Shoe& otherShoe)
- {
- if(otherShoe.paired) return false;
- if(orientation == otherShoe.orientation) return false;
- if(size != otherShoe.size) return false;
- paired = true;
- otherShoe.paired = true;
- return true;
- }
- };
- int main()
- {
- std::vector<Shoe> shoes;
- unsigned short N;
- std::cin >> N;
- for(unsigned short i=0;i < N ;i++)
- {
- shoes.push_back(Shoe());
- }
- for(Shoe& e:shoes)
- {
- if(e.paired) continue;
- for(Shoe& x:shoes)
- if(e == x) break;
- }
- unsigned short pairCount = 0;
- for(Shoe& e:shoes)
- {
- if(e.paired && e.orientation == 'L')
- pairCount++;
- }
- std::cout << pairCount;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement