Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
563 B
2
Indexable
Never
#include <bits/stdc++.h>

using namespace std;

int n, m, x, y, a, b, t, cnt, lin[10005], col[10005], l, c;
//vector<pair<int, int> > v;

int main(){
    
    ifstream fin("sah1.in");
    ofstream fout("sah1.out");
    
    fin>>t;
    fin>>n>>m;
    fin>>x>>y;
    
    while(m--){
        fin>>a>>b;
        lin[a]=1;
        col[b]=1;
        if(a==x || b==y) cnt++;
    }
 
    for(int i=1; i<=n; i++){
        if(lin[i]==0) l++;
        if(col[i]==0) c++;
    }

    if(t==1) fout<<cnt;
    else fout<<l*c;
   
    return 0;
}