Advertisement
Lexolordan

Untitled

Nov 3rd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. int t;
  10. cin >> t;
  11.  
  12. while (t--) {
  13. int n, m, X, Y;
  14. cin >> n >> m >> X >> Y;
  15. long long ans = 0;
  16.  
  17. for (int x = 1; x <= n; ++x)
  18. for (int y = 1; y <= n; ++y) {
  19. if (x == X && y == Y)
  20. continue;
  21.  
  22. int cnt = 0;
  23. cnt += 2 * (n - 1);
  24. cnt += min(x - 1, y - 1);
  25. cnt += min(y - 1, n - x);
  26. cnt += min(n - x, m - y);
  27. cnt += min(m - y, x - 1);
  28.  
  29.  
  30. if (x == X) {
  31. if (Y < y)
  32. cnt -= y;
  33. else
  34. cnt -=
  35. }
  36.  
  37. if (y == Y) {
  38. //
  39. }
  40. }
  41. }
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement