Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- #include <unordered_set>
- using namespace std;
- int main() {
- unordered_map<int, unordered_set<int>> tc_ac;//key - turtles count, value - turtles counts after i-th turtle
- size_t operations_count;
- cin >> operations_count;
- for (size_t i = 0; i < operations_count; ++i) {
- int before, after; //turtles count before i-th turtle and turtles count afetr i-th turtle
- cin >> before >> after;
- //if (before < 0 || after < 0) continue;
- tc_ac[before + 1 + after].insert(after);
- }
- int result = tc_ac.begin()->second.size();
- for (const auto& [_, after] : tc_ac) {
- if (after.size() > result) result = after.size();
- }
- cout << result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement