fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <iomanip>
  4. #include <string>
  5. #include <algorithm>
  6. #include <cmath>
  7. #include <map>
  8. #include <set>
  9. #include <vector>
  10. #include <deque>
  11. #include <queue>
  12. #include <stack>
  13. //#include <cassert>
  14. #include <cstring>
  15. #include <sstream>
  16. #include <ctime>
  17. #include <stdexcept>
  18. #include <limits>
  19. #include <bitset>
  20. #ifdef __GXX_EXPERIMENTAL_CXX0X__
  21. #include <unordered_map>
  22. #include <unordered_set>
  23. #endif
  24.  
  25. using namespace std;
  26.  
  27. #define assert(x) if (!(x)) cout << "ASSERT FAILED ON {"#x"}! Line: " << __LINE__ << "\n" << flush, exit(1);
  28. #define assertwt(x) if (!(x)) {cout << "ASSERT FAILED ON {"#x"}! Line: " << __LINE__ << "\n" << flush; while(1);}
  29.  
  30. #define input_file(s) assert(freopen(s, "r", stdin))
  31. #define output_file(s) assert(freopen(s, "w", stdout))
  32. #define stderr_file(s) assert(freopen(s, "w", stderr))
  33.  
  34. #ifdef MY
  35. #define FLU cout << flush
  36. #else
  37. #define FLU 42
  38. #endif
  39.  
  40. #define ALL(a) (a).begin(), (a).end()
  41. #define FORAB(i, a, b) for (int i = a; i < b; ++i)
  42. #define DBG(x) z_dbg << #x" = " << x << "\n", FLU
  43. #ifdef MY
  44. #define CHECKPOINT z_dbg << "At line " << __LINE__ << ", clock: " << clock() << "\n", FLU
  45. #else
  46. #define CHECKPOINT 42
  47. #endif
  48.  
  49. typedef unsigned uint;
  50. typedef long long ll;
  51. typedef unsigned long long ull;
  52. typedef pair<int, int> ipair;
  53.  
  54. const double PI = 3.14159265358979323846;
  55. const double EPS = 1e-9;
  56.  
  57. const int INF = 2e9;
  58. const ll LINF = 1e18;
  59.  
  60. template<class T>
  61. const T sqr(const T &x) { return x * x; }
  62.  
  63. template<class T>
  64. const T &min(const T &a, const T &b, const T &c) { return min(min(a, b), c); }
  65.  
  66. template<class T>
  67. const T &max(const T &a, const T &b, const T &c) { return max(max(a, b), c); }
  68.  
  69. struct DbgStream {
  70. template <class T>
  71. DbgStream &operator<<(const T &x) {
  72. #ifdef MY
  73. cout << x;
  74. #endif
  75. return *this;
  76. }
  77. } z_dbg;
  78.  
  79. #define cerrr cerr
  80. #define cerr z_dbg
  81.  
  82. // !GLOB
  83.  
  84. int main() {
  85. #ifdef MY
  86. input_file("input.txt");
  87. output_file("output.txt");
  88. //stderr_file("stderr.txt");
  89. #else
  90. #define TASK_FILE_NAME "protocol"
  91. //input_file(TASK_FILE_NAME".in");
  92. //output_file(TASK_FILE_NAME".out");
  93. //input_file("input.txt");
  94. //output_file("output.txt");
  95. #endif
  96.  
  97. ios_base::sync_with_stdio(0);
  98.  
  99. // !MAIN
  100.  
  101. vector<int> px, py;
  102.  
  103. for (int r = 1; r <= 10000; ++r) {
  104. int x = r, y = 0;
  105.  
  106. while (x > 0) {
  107. while (sqr(x) + sqr(y + 1) <= sqr(r)) ++y;
  108. if (sqr(x) + sqr(y) == sqr(r)) {
  109. bool bad = 0;
  110. for (uint i = 0; i < px.size(); ++i) {
  111. for (uint j = i + 1; j < px.size(); ++j) {
  112. int x1 = px[j] - px[i], y1 = py[j] - py[i];
  113. int x2 = px[j] - x, y2 = py[j] - y;
  114. if (x1 * y2 - x2 * y1 == 0) {
  115. bad = 1;
  116. break;
  117. }
  118. }
  119. if (bad) break;
  120. }
  121. if (!bad) {
  122. px.push_back(x);
  123. py.push_back(y);
  124. if (px.size() >= 300) {
  125. for (uint i = 0; i < px.size(); ++i) {
  126. cout << px[i] << " " << py[i] << "\n";
  127. }
  128. return 0;
  129. }
  130. }
  131. }
  132. --x;
  133. }
  134. }
  135.  
  136. cout << "not enough :(\n";
  137. for (uint i = 0; i < px.size(); ++i) {
  138. cout << px[i] << " " << py[i] << "\n";
  139. }
  140.  
  141. return 0;
  142. }
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
Success #stdin #stdout 0.05s 3476KB
stdin
Standard input is empty
stdout
1 0
2 0
4 3
3 4
8 6
6 8
12 5
15 8
8 15
24 7
7 24
24 10
10 24
20 21
30 16
35 12
12 35
9 40
20 48
45 28
28 45
40 42
60 11
11 60
63 16
56 33
33 56
16 63
48 55
80 18
18 80
77 36
36 77
63 60
39 80
99 20
56 90
60 91
105 36
36 105
112 15
22 120
120 27
120 35
117 44
44 117
35 120
112 66
66 112
105 100
96 110
140 51
51 140
132 85
154 72
72 154
52 165
176 57
153 104
57 176
88 165
48 189
195 28
40 198
187 84
84 187
180 112
220 21
171 140
21 220
240 44
234 88
88 234
252 39
39 252
247 96
96 247
240 117
117 240
210 176
252 115
115 252
231 160
160 231
216 195
195 216
273 136
136 273
264 170
170 264
308 75
75 308
204 253
175 288
336 45
45 336
52 336
299 180
180 299
360 38
38 360
275 240
306 208
352 135
135 352
390 56
228 325
399 40
312 266
266 312
315 264
264 315
420 29
29 420
429 72
72 429
420 153
351 280
416 210
360 319
325 360
44 483
475 132
132 475
495 100
459 220
495 156
156 495
440 279
494 192
192 494
308 435
480 234
138 520
341 420
540 57
57 540
544 33
455 300
300 455
33 544
504 230
230 504
493 276
276 493
520 231
231 520
575 48
572 96
68 576
432 390
440 384
136 570
368 465
448 414
608 105
336 527
624 50
50 624
340 528
460 429
100 621
616 150
150 616
200 609
672 104
663 180
680 111
561 400
111 680
672 185
185 672
624 315
315 624
544 450
450 544
627 364
364 627
108 725
228 704
216 713
270 704
468 595
760 39
380 672
665 432
432 665
650 456
69 792
759 280
280 759
528 630
629 540
540 629
693 480
480 693
837 116
116 837
703 504
504 703
720 483
728 480
805 348
348 805
855 204
204 855
560 684
874 168
406 792
168 874
702 560
560 702
780 451
451 780
777 464
464 777
760 522
522 760
924 43
880 285
756 533
533 756
520 765
43 924
912 215
215 912
936 75
728 615
884 387
969 108
108 969
945 248
248 945
864 473
925 372
864 525
1023 64
645 812
990 312
880 558
558 880
357 980
92 1056
1050 184
870 616
616 870
184 1050
276 1040
1071 228
928 585
585 928
1071 272
943 576
744 817
700 855
576 943
825 756
756 825
1080 329
329 1080
1056 405
1035 456
456 1035
1040 462
462 1040
528 1025
1155 68
570 1008
192 1144
1020 567
567 1020
340 1131
1020 611
989 660
660 989
49 1200
1107 476
798 936
1216 210
1075 612
612 1075
441 1160
799 960
100 1248
261 1248
1035 748
1218 400
160 1275
1224 435
1292 144
816 1012
987 884
1026 840
1300 345
1152 700
1240 561
561 1240
1081 840
840 1081
1360 222