Advertisement
Guest User

Chess

a guest
Apr 18th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. using ll = long long;
  4. using ld = long double;
  5. int main(){
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(nullptr);
  8. int n,m;
  9. cin>>n>>m;
  10. set<int> used[2];
  11. for(int i=0;i<m;i++){
  12. int x,y;
  13. cin>>x>>y;
  14. used[0].insert(x + y);
  15. used[1].insert(x - y);
  16. }
  17. int ans = 0;
  18. for(int x=1;x<=n;x++){
  19. for(int y=1;y<=n;y++){
  20. if(used[0].find(x + y) == used[0].end())
  21. if(used[1].find(x - y) == used[1].end())
  22. ans++;
  23. }
  24. }
  25. cout<<ans<<endl;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement