fork download
  1. #include<stdio.h>
  2. #include<algorithm>
  3. #include<iostream>
  4. #include<vector>
  5. using namespace std;
  6. #define max 53
  7. int map[max][max], block[max][max];
  8. int cnt=0;
  9. vector<pair<int, int> > ans;
  10. int find(int **block) {
  11.  
  12. }
  13.  
  14.  
  15.  
  16. int main() {
  17.  
  18. int n, u, v, w, y, x;
  19. cin >> n >> u >> v >> w >> x >> y;
  20. fill(map[0], map[0] + n + 2, 2);
  21. fill(map[n+1], map[n+1] + n + 2, 2);
  22. for (int i = 1; i <= n; i++) {
  23. map[i][0] = map[i][n + 1] = 2;
  24. }
  25. for (int i = 1; i <= n; i++) {
  26. for (int j = 1; j <= n; j++) {
  27. scanf("%d", &map[i][j]);
  28. }
  29. }
  30. block[0][0] = block[0][u+1]=2;
  31. fill(block[0]+1, block[0] + u+1, 1);
  32. for (int i = 1; i <= x; i++) {
  33. block[i][0] = block[i][u + 1] = 2;
  34. fill(block[i]+1, block[i] + w+1, 1);
  35. fill(block[i] + w+1, block[i] + w + y+1, 0);
  36. fill(block[i] + w + y + 1, block[i] + u + 1, 1);
  37. }
  38. for (int i = 1; i <= v; i++) {
  39. block[x+i][0] = block[x+i][u + 1] = 2;
  40. fill(block[x + i] + 1, block[x + i] + u + 1, 0);
  41. }
  42.  
  43. for (int i = 0; i <= x + v; i++) {
  44. for(int j=0;j<u+2;j++)
  45. printf("%d ", block[i][j]);
  46. printf("\n");
  47. }
  48. for (int i = 0; i < n+2; i++) {
  49. printf("\n");
  50. for (int j = 0; j < n+2; j++)
  51. printf("%d ", map[i][j]);
  52.  
  53. }
  54.  
  55. }
Success #stdin #stdout 0s 4580KB
stdin
16
5 1 1 1 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 1 1 0 1 1 1 1 1 1 1 0 0
0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0
0 1 0 0 1 1 0 1 1 1 1 1 1 1 0 0
0 1 0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