Advertisement
Josif_tepe

Untitled

Mar 3rd, 2025
138
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 <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, m;
  7.     cin >> n >> m;
  8.    
  9.     vector<int> v(n + 1, 0);
  10.    
  11.     for(int i = 0; i < m; i++) {
  12.         int x;
  13.         cin >> x;
  14.        
  15.         v[x] = 0;
  16.         int res = 0;
  17.         for(int j = 1; j <= n; j++) {
  18.             if(j != x) {
  19.                 v[j]++;
  20.                 res += v[j];
  21.             }
  22.            
  23.         }
  24.         cout << res << " " ;
  25.     }
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement