Guest User

Untitled

a guest
Dec 9th, 2019
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #pragma GCC target("sse4")
  3. #pragma GCC optimize("O3")
  4.  
  5. using namespace std;
  6.  
  7. int ara[2000][2000], n, k, x, y;
  8.  
  9. int main()
  10. {
  11. iostream::sync_with_stdio(0); cin.tie(0);
  12. x = 1000;
  13. y = 1000;
  14. n = 5;
  15. k = 5;
  16. ara[x][y] = 1;
  17. for (int xx = 0 ; xx < 5 ; xx++)
  18. {
  19. for (int i = 0 ; i < n ; i++)
  20. {
  21. x++;
  22. ara[x][y] = 1;
  23. }
  24. for (int i = 0 ; i < n ; i++)
  25. {
  26. y++;
  27. ara[x][y] = 1;
  28. }
  29. n += k;
  30. for (int i = 0 ; i < n ; i++)
  31. {
  32. x--;
  33. ara[x][y] = 1;
  34. }
  35. for (int i = 0 ; i < n ; i++)
  36. {
  37. y--;
  38. ara[x][y] = 1;
  39. }
  40. n += k;
  41. }
  42. int maxi = -1, ans;
  43. for (k = 1 ; k < 100 ; k++)
  44. {
  45. x = 1000 - 11;
  46. y = 1000 + 11;
  47. n = k;
  48. int s = ara[x][y];
  49. for (int xx = 0 ; xx < 5 ; xx++)
  50. {
  51. for (int i = 0 ; i < n ; i++)
  52. {
  53. x++;
  54. s += ara[x][y];
  55. }
  56. for (int i = 0 ; i < n ; i++)
  57. {
  58. y++;
  59. s += ara[x][y];
  60. }
  61. n += k;
  62. for (int i = 0 ; i < n ; i++)
  63. {
  64. x--;
  65. s += ara[x][y];
  66. }
  67. for (int i = 0 ; i < n ; i++)
  68. {
  69. y--;
  70. s += ara[x][y];
  71. }
  72. n += k;
  73. }
  74. if (s > maxi)
  75. {
  76. maxi = s;
  77. ans = k;
  78. }
  79. }
  80. cout << ans;
  81. return 0;
  82. }
RAW Paste Data