Advertisement
ivangarvanliev

Untitled

Feb 25th, 2025
2,843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <unordered_map>
  3. using namespace std;
  4.  
  5. int main() {
  6.     ios::sync_with_stdio(false);
  7.     cin.tie(nullptr);
  8.  
  9.     int N, M;
  10.     cin >> N >> M;
  11.  
  12.     unordered_map<int, int> last_sent;
  13.     int unread = 0;
  14.  
  15.     for (int i = 0; i < M; i++) {
  16.         int sender;
  17.         cin >> sender;
  18.  
  19.         unread -= last_sent[sender];
  20.         last_sent[sender] = unread + 1;
  21.         unread += N - 1;
  22.         cout << unread << "\n";
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement