fork download
  1. int c1, c2, c3, ug;
  2. in >> c1 >> c2 >> c3 >> ug;
  3.  
  4. if (ug % 2 == 0) {
  5.  
  6. }
  7.  
  8. vector<vector<int>> res(5, vector<int>(800, 0));
  9.  
  10. int firstRow = 1;
  11. int lastRow = 3;
  12. int lastCol;
  13. int num = 2;
  14. if (ug % 2 == 1) {
  15. res[1][0] = 1;
  16. res[1][1] = 1;
  17. res[2][0] = 1;
  18. res[3][0] = 2;
  19. res[3][1] = 2;
  20.  
  21. int topCnt = 2;
  22. int botCnt = 2;
  23.  
  24. --ug;
  25. --c2;
  26. --c3;
  27.  
  28. for (int i = 0; i < ug / 2; ++i) {
  29. ++num;
  30. if (topCnt < botCnt) {
  31. res[1][topCnt] = num;
  32. res[0][topCnt] = num;
  33. ++topCnt;
  34. res[0][topCnt] = num;
  35. ++topCnt;
  36. ++num;
  37. res[1][topCnt] = num;
  38. res[0][topCnt] = num;
  39. ++topCnt;
  40. res[1][topCnt] = num;
  41. ++topCnt;
  42. firstRow = 0;
  43. } else {
  44. res[3][botCnt] = num;
  45. res[4][botCnt] = num;
  46. ++botCnt;
  47. res[4][botCnt] = num;
  48. ++botCnt;
  49. ++num;
  50. res[3][botCnt] = num;
  51. res[4][botCnt] = num;
  52. ++botCnt;
  53. res[3][botCnt] = num;
  54. ++botCnt;
  55. lastRow = 4;
  56. }
  57. }
  58.  
  59. for (int i = 0; i < c3; ++i) {
  60. ++num;
  61. if (topCnt < botCnt) {
  62. for(int j: range(3)) {
  63. res[1][topCnt] = num;
  64. ++topCnt;
  65. }
  66. } else {
  67. for(int j: range(3)) {
  68. res[3][botCnt] = num;
  69. ++botCnt;
  70. }
  71. }
  72. }
  73.  
  74. for (int i = 0; i < c2; ++i) {
  75. ++num;
  76. if (topCnt < botCnt) {
  77. for(int j: range(2)) {
  78. res[1][topCnt] = num;
  79. ++topCnt;
  80. }
  81. } else {
  82. for(int j: range(2)) {
  83. res[3][botCnt] = num;
  84. ++botCnt;
  85. }
  86. }
  87. }
  88.  
  89. for (int i = 0; i < c1; ++i) {
  90. ++num;
  91. if (topCnt < botCnt) {
  92. for(int j: range(1)) {
  93. res[1][topCnt] = num;
  94. ++topCnt;
  95. }
  96. } else {
  97. for(int j: range(1)) {
  98. res[3][botCnt] = num;
  99. ++botCnt;
  100. }
  101. }
  102. }
  103. cerr << topCnt << ' ' << botCnt << endl;
  104.  
  105. assert(topCnt == botCnt);
  106. ++num;
  107. res[1][topCnt] = num;
  108. res[2][topCnt] = num;
  109. res[3][topCnt] = num;
  110. lastCol = topCnt;
  111. } else {
  112. res[1][0] = 1;
  113. res[1][1] = 1;
  114. res[2][0] = 1;
  115. res[3][0] = 2;
  116. res[3][1] = 2;
  117. res[3][2] = 2;
  118.  
  119. int topCnt = 2;
  120. int botCnt = 3;
  121.  
  122. --ug;
  123. --ug;
  124. --c3;
  125. --c3;
  126. for (int i = 0; i < ug / 2; ++i) {
  127. ++num;
  128. if (topCnt < botCnt) {
  129. res[1][topCnt] = num;
  130. res[0][topCnt] = num;
  131. ++topCnt;
  132. res[0][topCnt] = num;
  133. ++topCnt;
  134. ++num;
  135. res[1][topCnt] = num;
  136. res[0][topCnt] = num;
  137. ++topCnt;
  138. res[1][topCnt] = num;
  139. ++topCnt;
  140. firstRow = 0;
  141. } else {
  142. res[3][botCnt] = num;
  143. res[4][botCnt] = num;
  144. ++botCnt;
  145. res[4][botCnt] = num;
  146. ++botCnt;
  147. ++num;
  148. res[3][botCnt] = num;
  149. res[4][botCnt] = num;
  150. ++botCnt;
  151. res[3][botCnt] = num;
  152. ++botCnt;
  153. lastRow = 4;
  154. }
  155. }
  156.  
  157. for (int i = 0; i < c3; ++i) {
  158. ++num;
  159. if (topCnt < botCnt) {
  160. for(int j: range(3)) {
  161. res[1][topCnt] = num;
  162. ++topCnt;
  163. }
  164. } else {
  165. for(int j: range(3)) {
  166. res[3][botCnt] = num;
  167. ++botCnt;
  168. }
  169. }
  170. }
  171.  
  172. for (int i = 0; i < c2; ++i) {
  173. ++num;
  174. if (topCnt < botCnt) {
  175. for(int j: range(2)) {
  176. res[1][topCnt] = num;
  177. ++topCnt;
  178. }
  179. } else {
  180. for(int j: range(2)) {
  181. res[3][botCnt] = num;
  182. ++botCnt;
  183. }
  184. }
  185. }
  186.  
  187. for (int i = 0; i < c1; ++i) {
  188. ++num;
  189. if (topCnt < botCnt) {
  190. for(int j: range(1)) {
  191. res[1][topCnt] = num;
  192. ++topCnt;
  193. }
  194. } else {
  195. for(int j: range(1)) {
  196. res[3][botCnt] = num;
  197. ++botCnt;
  198. }
  199. }
  200. }
  201. cerr << topCnt << ' ' << botCnt << endl;
  202. assert(topCnt + 1 == botCnt);
  203. ++num;
  204. for(int j: range(3)) {
  205. res[1][topCnt] = num;
  206. ++topCnt;
  207. }
  208. ++num;
  209. res[3][botCnt] = num;
  210. res[3][botCnt + 1] = num;
  211. res[2][botCnt + 1] = num;
  212. lastCol = botCnt + 1;
  213. }
  214.  
  215.  
  216. out << (lastRow - firstRow + 1) << ' ' << lastCol + 1 << "\n";
  217. for (int i: inclusiveRange(firstRow, lastRow)) {
  218. for (int j: inclusiveRange(0, lastCol)) {
  219. out << res[i][j] << " ";
  220. }
  221. out << "\n";
  222. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:3: error: ‘in’ does not name a type
   in >> c1 >> c2 >> c3 >> ug;
   ^~
prog.cpp:4:3: error: expected unqualified-id before ‘if’
   if (ug % 2 == 0) {
   ^~
prog.cpp:8:3: error: ‘vector’ does not name a type
   vector<vector<int>> res(5, vector<int>(800, 0));
   ^~~~~~
prog.cpp:14:3: error: expected unqualified-id before ‘if’
   if (ug % 2 == 1) {
   ^~
stdout
Standard output is empty