Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int n,m;
- cin>>n>>m;
- set<int> used[2];
- for(int i=0;i<m;i++){
- int x,y;
- cin>>x>>y;
- used[0].insert(x + y);
- used[1].insert(x - y);
- }
- int ans = 0;
- for(int x=1;x<=n;x++){
- for(int y=1;y<=n;y++){
- if(used[0].find(x + y) == used[0].end())
- if(used[1].find(x - y) == used[1].end())
- ans++;
- }
- }
- cout<<ans<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement