fork download
  1. #include <bits/stdc++.h>
  2. #define debug(x) cout << #x << " = " << x << endl
  3. #define REP(i,n) for(Long i = 0; i < (Long)n; i++)
  4. #define pb push_back
  5. using namespace std;
  6.  
  7. typedef long long Long;
  8.  
  9. struct Data{
  10. Long x , y;
  11. Long d;
  12. Data(){}
  13. Data(Long x, Long y, Long d) : x(x), y(y), d(d){}
  14. };
  15.  
  16. mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  17.  
  18. Long random(Long a, Long b) {
  19. return uniform_int_distribution<Long>(a , b)(rng);
  20. }
  21.  
  22. int main() {
  23. ios_base::sync_with_stdio(false);
  24. cin.tie(NULL);
  25. cout.tie(NULL);
  26.  
  27. Long sz = 200;
  28.  
  29. map<pair<Long,Long> , bool> vis;
  30. deque<Data> q;
  31.  
  32. vector<pair<Long,Long>> cells = {make_pair(0,0) };
  33. vis[{0,0}]= true;
  34.  
  35. vis[{1, 0}] = true;
  36. q.pb(Data(1,0,1));
  37.  
  38. while(true){
  39. Long curD = q.front().d;
  40. vector<pair<Long,Long>> add;
  41.  
  42. while(!q.empty() && curD == q.front().d){
  43. Data u = q.front();
  44.  
  45. q.pop_front();
  46. add.pb({u.x, u.y});
  47. vis[{u.x, u.y}] = true;
  48. for(Long a = -1; a <= 1; a++){
  49. for(Long b = -1; b <= 1; b++){
  50. if(abs(a) + abs(b) != 1) continue;
  51. if(u.x + a > 0 && !vis[{a + u.x , b + u.y}]){
  52. vis[{a + u.x , b + u.y}] = true;
  53. q.pb(Data(a + u.x, b + u.y , u.d + 1));
  54. }
  55. }
  56. }
  57. }
  58. if(add.size() + cells.size() > sz){
  59. break;
  60. }
  61. for(auto p : add) cells.pb(p);
  62. }
  63. Long minX = 1e18;
  64. Long minY = 1e18;
  65. for(auto c : cells){
  66. minX = min(minX, c.first);
  67. minY = min(minY, c.second);
  68. }
  69. Long maxX = -1;
  70. Long maxY = -1;
  71. for(Long i = 0; i < cells.size(); i++){
  72. cells[i].first += -minX + 1;
  73. cells[i].second += -minY + 1;
  74. maxX = max(maxX, cells[i].first);
  75. maxY = max(maxY , cells[i].second);
  76. }
  77. Long n = maxX;
  78. Long m = maxY;
  79. Long T = 1;
  80. cout << T << endl;
  81. cout << n << " " << m << " " << cells.size() << endl;
  82. REP( i , n){
  83. REP(j , m){
  84. cout << random(-20 , 20) << " " ;
  85. }
  86. cout << endl;
  87. }
  88. //cout << "cells = " << endl;
  89. for(auto c : cells){
  90. cout << c.first << " " << c.second << " " << random(-20 , 20) << endl;
  91. }
  92. return 0;
  93. }
  94.  
Success #stdin #stdout 0s 4324KB
stdin
Standard input is empty
stdout
1
15 27 197
-10 -15 3 10 -13 6 0 14 1 0 -19 -13 -13 -15 19 -17 -15 16 -18 8 0 12 11 -19 5 -20 -3 
13 18 7 -17 -12 -1 -8 6 19 3 0 13 -5 9 5 13 5 -3 10 5 3 -18 15 8 18 3 14 
-14 -8 -17 18 4 9 -16 -8 13 -1 -1 -16 -1 1 -3 -19 1 18 -7 5 -17 17 -12 5 -11 -17 8 
-5 16 7 6 -12 -20 4 10 -6 4 13 -7 -7 -8 0 -12 -19 18 14 -5 1 12 -18 18 20 7 15 
-1 1 2 -19 7 -12 -20 1 -2 -8 16 -7 -5 -14 3 -10 -15 14 -19 -5 -7 -13 19 0 -9 -6 -16 
12 -13 9 -16 -15 2 -15 4 20 13 17 -16 12 11 -13 6 -9 3 -6 -9 -2 -1 2 -19 7 -20 4 
8 -16 14 8 20 17 11 10 -16 -14 11 -5 -15 -4 10 -6 -17 14 -5 -2 -20 -5 -5 18 -17 -13 -3 
-14 -4 -6 -19 13 -9 -10 20 -9 -17 10 14 -17 -14 15 11 13 20 7 -8 -8 3 -6 -3 -14 15 -15 
-3 -11 -9 5 -18 14 6 -2 -16 7 18 11 14 -17 -13 2 0 -12 -2 11 -17 -18 -18 -14 -15 11 -7 
18 16 18 -20 -7 -18 1 9 10 -12 16 9 -3 -18 16 -3 -6 -7 0 6 -7 -19 12 -14 -19 -17 -6 
16 -13 18 -12 -13 14 -7 9 4 -9 -18 -18 4 -9 -10 -16 0 5 8 -18 -18 17 0 10 -3 -8 20 
-2 1 3 -20 9 10 1 19 -2 -17 -4 -12 16 -2 18 20 4 -5 -14 0 0 -12 -12 6 -5 7 20 
18 -10 5 5 13 -3 16 -20 12 -6 -20 7 -19 11 -16 -13 4 -10 -5 -15 -6 5 17 15 19 -20 -10 
10 5 8 -15 19 -7 5 13 -10 -15 19 6 8 19 -7 9 -8 11 -13 -19 -6 -18 -6 10 4 -10 7 
-15 12 17 -11 4 11 15 5 -3 1 2 -7 -10 -20 -16 -10 -19 18 -12 -18 18 -13 -15 -1 3 11 -6 
1 14 -12
2 14 2
2 13 17
2 15 -5
3 14 16
2 12 -17
3 13 5
2 16 11
3 15 5
4 14 -8
2 11 -3
3 12 -3
4 13 -10
2 17 3
3 16 -7
4 15 20
5 14 19
2 10 17
3 11 -9
4 12 -7
5 13 3
2 18 19
3 17 -19
4 16 14
5 15 17
6 14 17
2 9 0
3 10 -2
4 11 16
5 12 18
6 13 8
2 19 -1
3 18 16
4 17 9
5 16 -19
6 15 -16
7 14 12
2 8 -19
3 9 6
4 10 -4
5 11 -9
6 12 4
7 13 3
2 20 17
3 19 9
4 18 -16
5 17 -6
6 16 11
7 15 -20
8 14 9
2 7 2
3 8 15
4 9 -3
5 10 20
6 11 -20
7 12 -1
8 13 17
2 21 -15
3 20 -19
4 19 -16
5 18 -15
6 17 5
7 16 15
8 15 1
9 14 -6
2 6 -8
3 7 -14
4 8 11
5 9 2
6 10 -11
7 11 12
8 12 -13
9 13 13
2 22 -10
3 21 6
4 20 -13
5 19 -8
6 18 4
7 17 -9
8 16 -2
9 15 -14
10 14 -11
2 5 9
3 6 5
4 7 13
5 8 17
6 9 -2
7 10 16
8 11 18
9 12 -17
10 13 7
2 23 7
3 22 8
4 21 0
5 20 -5
6 19 16
7 18 18
8 17 -2
9 16 8
10 15 0
11 14 2
2 4 -7
3 5 -8
4 6 -19
5 7 -10
6 8 10
7 9 -11
8 10 -15
9 11 -7
10 12 17
11 13 5
2 24 -9
3 23 -20
4 22 -9
5 21 -9
6 20 5
7 19 7
8 18 8
9 17 -3
10 16 -3
11 15 14
12 14 9
2 3 1
3 4 -9
4 5 -11
5 6 20
6 7 1
7 8 11
8 9 -12
9 10 -14
10 11 -17
11 12 18
12 13 -20
2 25 6
3 24 -17
4 23 -5
5 22 10
6 21 -16
7 20 -2
8 19 -12
9 18 2
10 17 -15
11 16 0
12 15 13
13 14 14
2 2 -20
3 3 1
4 4 8
5 5 15
6 6 14
7 7 -19
8 8 -19
9 9 18
10 10 -13
11 11 13
12 12 5
13 13 14
2 26 -11
3 25 -7
4 24 -5
5 23 16
6 22 12
7 21 9
8 20 17
9 19 -14
10 18 13
11 17 -9
12 16 6
13 15 18
14 14 -15
2 1 -3
3 2 -15
4 3 8
5 4 10
6 5 -7
7 6 6
8 7 -6
9 8 -17
10 9 -11
11 10 6
12 11 -8
13 12 -1
14 13 18
2 27 -14
3 26 -6
4 25 5
5 24 18
6 23 1
7 22 -18
8 21 14
9 20 5
10 19 13
11 18 -13
12 17 -13
13 16 -7
14 15 -8
15 14 11