Untitled

 avatar
user_5668965
c_cpp
19 days ago
427 B
1
Indexable
Never
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define sz size()
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
    ll t,n,m,x,y,p,q,i,j,k,answer=0;
    cin>>n>>m;
    set<ll> row,col;
    while(m--){
        cin>>x>>y;
        row.insert(x) , col.insert(y);
        answer = n*n - (row.sz+col.sz)*n + (ll)row.sz*(ll)col.sz; 
        cout<<answer<<" ";
    }
}
Leave a Comment