Advertisement
a53

bpj2020

a53
Apr 14th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. bool t[9][9],C[9][9];
  4.  
  5. int main()
  6. {
  7. ifstream f ("bpj2020.in");
  8. int n,a,l,c,s=0;
  9. f>>n;
  10. while(n--)
  11. {
  12. f>>a>>l>>c;
  13. if(a<=5)
  14. {
  15. s=s+a;
  16. for(int j=c;j<=c+a-1;++j)
  17. t[l][j]=1;
  18. }
  19. else if(a==6)
  20. {
  21. s=s+4;
  22. t[l][c]=1;
  23. t[l][c+1]=1;
  24. t[l+1][c]=1;
  25. t[l+1][c+1]=1;
  26. }
  27. else if(a==7)
  28. {
  29. s=s+9;
  30. t[l][c]=1;
  31. t[l][c+1]=1;
  32. t[l][c+2]=1;
  33. t[l+1][c]=1;
  34. t[l+1][c+1]=1;
  35. t[l+1][c+2]=1;
  36. t[l+2][c]=1;
  37. t[l+2][c+1]=1;
  38. t[l+2][c+2]=1;
  39. }
  40. else if(a<=11)
  41. {
  42. s=s+a-7+1;
  43. for(int j=l;j<=l+a-7;++j)
  44. t[j][c]=1;
  45. }
  46. else if(a==12)
  47. {
  48. s=s+3;
  49. t[l][c]=1;
  50. t[l+1][c]=1;
  51. t[l][c+1]=1;
  52. }
  53. else if(a==13)
  54. {
  55. s=s+4;
  56. t[l][c]=1;
  57. t[l+1][c-1]=1;
  58. t[l+1][c]=1;
  59. t[l+1][c+1]=1;
  60. }
  61. else if(a==14)
  62. {
  63. s=s+4;
  64. t[l][c]=1;
  65. t[l+1][c]=1;
  66. t[l+1][c+1]=1;
  67. t[l+2][c+1]=1;
  68. }
  69. else if(a==15)
  70. {
  71. s=s+4;
  72. t[l][c]=1;
  73. t[l][c+1]=1;
  74. t[l+1][c-1]=1;
  75. t[l+1][c]=1;
  76. }
  77. else if(a==16)
  78. {
  79. s=s+5;
  80. t[l][c]=1;
  81. t[l][c+1]=1;
  82. t[l][c+2]=1;
  83. t[l+1][c+2]=1;
  84. t[l+2][c+2]=1;
  85. }
  86. else if(a==17)
  87. {
  88. s=s+4;
  89. t[l][c]=1;
  90. t[l+1][c]=1;
  91. t[l+1][c+1]=1;
  92. t[l+1][c+2]=1;
  93. }
  94. int rand_elim=0;
  95. for(int i=1;i<=8;++i)
  96. {
  97. for(int j=1;j<=8;++j)
  98. C[i][j]=t[i][j];
  99. }
  100. for(int i=1;i<=8;++i)
  101. {
  102. int cnt=0;
  103. for(int j=1;j<=8;++j)
  104. {
  105. if(t[i][j]==1)
  106. cnt++;
  107. }
  108. if(cnt>=8)
  109. {
  110. rand_elim++;
  111. for(int j=1;j<=8;++j)
  112. {
  113. C[i][j]=0;
  114. }
  115. }
  116. }
  117. for(int j=1;j<=8;++j)
  118. {
  119. int cnt=0;
  120. for(int i=1;i<=8;++i)
  121. {
  122. if(t[i][j]==1)
  123. cnt++;
  124. }
  125. if(cnt>=8)
  126. {
  127. rand_elim++;
  128. for(int i=1;i<=8;++i)
  129. {
  130. C[i][j]=0;
  131. }
  132. }
  133. }
  134. if(rand_elim==1)
  135. s+=10;
  136. else if(rand_elim==2)
  137. s+=30;
  138. else if(rand_elim==3)
  139. s+=60;
  140. else if(rand_elim==4)
  141. s+=100;
  142. else if(rand_elim==5)
  143. s+=150;
  144. else if(rand_elim==6)
  145. s+=500;
  146. for(int i=1;i<=8;++i)
  147. {
  148. for(int j=1;j<=8;++j)
  149. {
  150. if(C[i][j]==0)
  151. t[i][j]=0;
  152. }
  153. }
  154. }
  155. f.close();
  156. ofstream g("bpj2020.out");
  157. g<<s;
  158. g.close();
  159. return 0;
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement