fork download
  1. #include<iostream>
  2. #include<cstdio>
  3. using namespace std;
  4. int Honloan,Trattu;
  5. int DEF[7] = { 0, 3, 27, 99, 729, 6561, 59049 };
  6. int ATT[7] = { 0, 9, 54, 162, 1458, 13112, 118008 };
  7. int a[12][32],b[12][32];
  8. void Welcometosummonerrift(){
  9. for(int i = 0;i <= 10; i++){
  10. for(int j = 0;j <= 28; j++){
  11. b[i][j] = 0;
  12. }
  13. }
  14. }
  15. int attack(int i,int j){
  16. int Point = 0;
  17. //HANG NGANG
  18. int ystop = 0,rvtop = 0, ysbot = 0,rvbot = 0;
  19. //Trai
  20. for(int m = 1; m < 6 && j - 2 * m >= 0; m++){
  21. if(a[i][j - 2 * m] == Honloan)ystop++;
  22. if(a[i][j - 2 * m] == Trattu){
  23. rvtop++;
  24. break;
  25. }
  26. if(a[i][j - 2 * m]==0){
  27. break;
  28. }
  29. }
  30. //Phai
  31. for(int m = 1 ;m < 6 && j + 2 * m <= 28; m++){
  32. if(a[i][j + 2 * m] == Honloan)ysbot++;
  33. if(a[i][j + 2 * m] == Trattu){
  34. rvbot++;
  35. break;
  36. }
  37. if(a[i][j + 2 * m]==0){
  38. break;
  39. }
  40. }
  41. //Cheo huyen
  42. int xayahtop=0,rakantop=0,xayahbot=0,rakanbot=0;
  43. //Duoi len
  44. for(int m = 1; m < 6 && i - m >= 0 && j - m >= 0;m++){
  45. if(a[i - m][j - m ] == Honloan) xayahtop++;
  46. if(a[i - m][j - m ] == Trattu){
  47. rakantop++;
  48. break;
  49. }
  50. if(a[i - m][j - m] == 0){
  51. break;
  52. }
  53. }
  54. //Tren xuong
  55. for(int m = 1; m < 6 && i + m <= 10 && j + m <= 28; m++){
  56. if(a[i + m][j + m] == Honloan) xayahbot++;
  57. if(a[i + m][j + m] == Trattu){
  58. rakanbot++;
  59. break;
  60. }
  61. if(a[i + m][j + m] == 0){
  62. break;
  63. }
  64. }
  65. //Cheo sac
  66. int leetop=0,yitop=0,leebot=0,yibot=0,luxmid1=0,luxmid2=0;
  67. for(int m = 1; m < 6 && i - m >= 0 && j + m <= 28 ; m++){
  68. if(a[i - m][j + m] == Honloan)leetop++;
  69. if(a[i - m][j + m] == Trattu){
  70. yitop++;
  71. break;
  72. }
  73. if(a[i - m][j + m]==0){
  74. break;
  75. }
  76. }
  77. for(int m = 1; m < 6 && i + m <= 10 && j - m >= 0 ; m++){
  78. if(a[i + m][j - m] == Honloan)leebot++;
  79. if(a[i + m][j - m] == Trattu){
  80. yibot++;
  81. break;
  82. }
  83. if(a[i + m][j - m] == 0){
  84. break;
  85. }
  86. }
  87. if(rvtop + rvbot == 2) Point = 0;
  88. else{
  89. Point += ATT[ystop + ysbot];
  90. }
  91. if(rakantop + rakanbot == 2) Point = 0;
  92. else{
  93. Point += ATT[xayahtop + xayahbot];
  94. }
  95. if(yitop + yibot == 2) Point = 0;
  96. else{
  97. Point += ATT[leetop + leebot];
  98. }
  99. if(ystop == 2 && xayahtop == 2 && ysbot == 0 && xayahbot == 0 ){
  100. if(rvbot == 0 && rakanbot == 0 ){
  101. Point = Point + 5 * Point / 6 ;
  102. }
  103. if(rvbot == 1 || rakanbot == 1){
  104. Point = Point + 3 * Point / 4;
  105. }
  106. }
  107. if(ystop == 2 && xayahbot == 2 && ysbot == 0 && xayahtop == 0 ){
  108. if(rvbot == 0 && rakantop == 0 ){
  109. Point = Point + 5 * Point / 6 ;
  110. }
  111. if(rvbot == 1 || rakantop == 1){
  112. Point = Point + 3 * Point / 4;
  113. }
  114. }
  115. if(ystop == 2 && leetop == 2 && ysbot == 0 && leebot == 0 ){
  116. if(rvbot == 0 && yibot == 0 ){
  117. Point = Point + 5 * Point / 6 ;
  118. }
  119. if(rvbot == 1 || yibot == 1){
  120. Point = Point + 3 * Point / 4;
  121. }
  122. }
  123. if(ystop == 2 && leebot == 2 && ysbot == 0 && leetop == 0 ){
  124. if(rvbot == 0 && yitop == 0 ){
  125. Point = Point + 5 * Point / 6 ;
  126. }
  127. if(rvbot == 1 || yitop == 1){
  128. Point = Point + 3 * Point / 4;
  129. }
  130. }
  131. if(ysbot == 2 && xayahtop == 2 && ystop == 0 && xayahbot == 0 ){
  132. if(rvtop == 0 && rakanbot == 0 ){
  133. Point = Point + 5 * Point / 6 ;
  134. }
  135. if(rvtop == 1 || rakanbot == 1){
  136. Point = Point + 3 * Point / 4;
  137. }
  138. }
  139. if(ysbot == 2 && xayahbot == 2 && ystop == 0 && xayahtop == 0 ){
  140. if(rvtop == 0 && rakantop == 0 ){
  141. Point = Point + 5 * Point / 6 ;
  142. }
  143. if(rvtop == 1 || rakantop == 1){
  144. Point = Point + 3 * Point / 4;
  145. }
  146. }
  147. if(ysbot == 2 && leetop == 2 && ystop == 0 && leebot == 0 ){
  148. if(rvtop == 0 && yibot == 0 ){
  149. Point = Point + 5 * Point / 6 ;
  150. }
  151. if(rvtop == 1 || yibot == 1){
  152. Point = Point + 3 * Point / 4;
  153. }
  154. }
  155. if(ysbot == 2 && leebot == 2 && ystop == 0 && leetop == 0 ){
  156. if(rvtop == 0 && yitop == 0 ){
  157. Point = Point + 5 * Point / 6 ;
  158. }
  159. if(rvtop == 1 || yitop == 1){
  160. Point = Point + 3 * Point / 4;
  161. }
  162. }
  163. if(leetop == 2 && xayahtop == 2 && leebot == 0 && xayahbot == 0 ){
  164. if(yibot == 0 && rakanbot == 0 ){
  165. Point = Point + 5 * Point / 6 ;
  166. }
  167. if(yibot == 1 || rakanbot == 1){
  168. Point = Point + 3 * Point / 4;
  169. }
  170. }
  171. if(leebot == 2 && xayahbot == 2 && leetop == 0 && xayahtop == 0 ){
  172. if(yitop == 0 && rakantop == 0 ){
  173. Point = Point + 5 * Point / 6 ;
  174. }
  175. if(yitop == 1 || rakantop == 1){
  176. Point = Point + 3 * Point / 4;
  177. }
  178. }
  179. if(leetop == 2 && xayahbot == 2 && leebot == 0 && xayahtop == 0 ){
  180. if(yibot == 0 && rakantop == 0 ){
  181. Point = Point + 5 * Point / 6 ;
  182. }
  183. if(yibot == 1 || rakantop == 1){
  184. Point = Point + 3 * Point / 4;
  185. }
  186. }
  187. if(leebot == 2 && xayahtop == 2 && leetop == 0 && xayahbot == 0 ){
  188. if(yitop == 0 && rakanbot == 0 ){
  189. Point = Point + 5 * Point / 6 ;
  190. }
  191. if(yitop == 1 || rakanbot == 1){
  192. Point = Point + 3 * Point / 4;
  193. }
  194. }
  195. if(ystop == 1 && xayahtop == 2 && ysbot == 1 && xayahbot == 0 ){
  196. if(rvbot == 0 && rakanbot == 0 && rvtop == 0){
  197. Point = Point + 5 * Point / 6 ;
  198. }
  199. if(rvbot == 1 || rakanbot == 1 || rvtop == 1){
  200. Point = Point + 3 * Point / 4;
  201. }
  202. }
  203. if(ystop == 1 && xayahbot == 2 && ysbot == 1 && xayahtop == 0 ){
  204. if(rvbot == 0 && rakantop == 0 && rvtop == 0 ){
  205. Point = Point + 5 * Point / 6 ;
  206. }
  207. if(rvbot == 1 || rakantop == 1 || rvtop == 1){
  208. Point = Point + 3 * Point / 4;
  209. }
  210. }
  211. if(ystop == 1 && leetop == 2 && ysbot == 1 && leebot == 0 ){
  212. if(rvbot == 0 && yibot == 0 && rvtop == 0){
  213. Point = Point + 5 * Point / 6 ;
  214. }
  215. if(rvbot == 1 || yibot == 1 || rvtop == 1){
  216. Point = Point + 3 * Point / 4;
  217. }
  218. }
  219. if(ystop == 1 && leebot == 2 && ysbot == 1 && leetop == 0 ){
  220. if(rvbot == 0 && yitop == 0 && rvtop == 0 ){
  221. Point = Point + 5 * Point / 6 ;
  222. }
  223. if(rvbot == 1 || yitop == 1 || rvtop == 1){
  224. Point = Point + 3 * Point / 4;
  225. }
  226. }
  227. if(ysbot == 1 && xayahtop == 2 && ystop == 1 && xayahbot == 0 ){
  228. if(rvtop == 0 && rakanbot == 0 && rvbot == 0){
  229. Point = Point + 5 * Point / 6 ;
  230. }
  231. if(rvtop == 1 || rakanbot == 1 || rvbot == 1){
  232. Point = Point + 3 * Point / 4;
  233. }
  234. }
  235. if(ysbot == 1 && xayahbot == 2 && ystop == 1 && xayahtop == 0 ){
  236. if(rvtop == 0 && rakantop == 0 && rvbot == 0){
  237. Point = Point + 5 * Point / 6 ;
  238. }
  239. if(rvtop == 1 || rakantop == 1 || rvbot == 1){
  240. Point = Point + 3 * Point / 4;
  241. }
  242. }
  243. if(ysbot == 1 && leetop == 2 && ystop == 1 && leebot == 0 ){
  244. if(rvtop == 0 && yibot == 0 && rvbot == 0 ){
  245. Point = Point + 5 * Point / 6 ;
  246. }
  247. if(rvtop == 1 || yibot == 1 || rvbot == 1){
  248. Point = Point + 3 * Point / 4;
  249. }
  250. }
  251. if(ysbot == 1 && leebot == 2 && ystop == 1 && leetop == 0 ){
  252. if(rvtop == 0 && yitop == 0 && rvbot == 0 ){
  253. Point = Point + 5 * Point / 6 ;
  254. }
  255. if(rvtop == 1 || yitop == 1 || rvbot == 1){
  256. Point = Point + 3 * Point / 4;
  257. }
  258. }
  259. if(leetop == 1 && xayahtop == 2 && leebot == 1 && xayahbot == 0 ){
  260. if(yibot == 0 && rakanbot == 0 && yitop == 0){
  261. Point = Point + 5 * Point / 6 ;
  262. }
  263. if(yibot == 1 || rakanbot == 1 || yitop == 1){
  264. Point = Point + 3 * Point / 4;
  265. }
  266. }
  267. if(leebot == 1 && xayahbot == 2 && leetop == 1 && xayahtop == 0 ){
  268. if(yitop == 0 && rakantop == 0 && yibot == 0 ){
  269. Point = Point + 5 * Point / 6 ;
  270. }
  271. if(yitop == 1 || rakantop == 1 || yibot == 1 ){
  272. Point = Point + 3 * Point / 4;
  273. }
  274. }
  275. if(leetop == 1 && xayahbot == 2 && leebot == 1 && xayahtop == 0 ){
  276. if(yibot == 0 && rakantop == 0 && yitop == 0 ){
  277. Point = Point + 5 * Point / 6 ;
  278. }
  279. if(yibot == 1 || rakantop == 1 || yitop == 1){
  280. Point = Point + 3 * Point / 4;
  281. }
  282. }
  283. if(leebot == 1 && xayahtop == 2 && leetop == 1 && xayahbot == 0 ){
  284. if(yitop == 0 && rakanbot == 0 && yibot == 0){
  285. Point = Point + 5 * Point / 6 ;
  286. }
  287. if(yitop == 1 || rakanbot == 1 || yibot == 1){
  288. Point = Point + 2 * Point / 3;
  289. }
  290. }
  291. if(ystop == 2 && xayahtop == 1 && ysbot == 0 && xayahbot == 1 ){
  292. if(rvbot == 0 && rakanbot == 0 && rakantop == 0 ){
  293. Point = Point + 5 * Point / 6 ;
  294. }
  295. if(rvbot == 1 || rakanbot == 1 || rakantop == 1 ){
  296. Point = Point + 3 * Point / 4;
  297. }
  298. }
  299. if(ystop == 2 && xayahbot == 1 && ysbot == 0 && xayahtop == 1 ){
  300. if(rvbot == 0 && rakantop == 0 && rakanbot == 0 ){
  301. Point = Point + 5 * Point / 6 ;
  302. }
  303. if(rvbot == 1 || rakantop == 1 || rakanbot == 1){
  304. Point = Point + 3 * Point / 4;
  305. }
  306. }
  307. if(ystop == 2 && leetop == 1 && ysbot == 0 && leebot == 1 ){
  308. if(rvbot == 0 && yibot == 0 && yitop == 0){
  309. Point = Point + 5 * Point / 6 ;
  310. }
  311. if(rvbot == 1 || yibot == 1 || yitop == 1){
  312. Point = Point + 3 * Point / 4;
  313. }
  314. }
  315. if(ystop == 2 && leebot == 1 && ysbot == 0 && leetop == 1 ){
  316. if(rvbot == 0 && yitop == 0 && yibot == 0 ){
  317. Point = Point + 5 * Point / 6 ;
  318. }
  319. if(rvbot == 1 || yitop == 1 || yibot == 1){
  320. Point = Point + 3 * Point / 4;
  321. }
  322. }
  323. if(ysbot == 2 && xayahtop == 1 && ystop == 0 && xayahbot == 1 ){
  324. if(rvtop == 0 && rakanbot == 0 && rakantop == 0){
  325. Point = Point + 5 * Point / 6 ;
  326. }
  327. if(rvtop == 1 || rakanbot == 1 || rakantop == 1){
  328. Point = Point + 3 * Point / 4;
  329. }
  330. }
  331. if(ysbot == 2 && xayahbot == 1 && ystop == 0 && xayahtop == 1 ){
  332. if(rvtop == 0 && rakantop == 0 && rakanbot == 0 ){
  333. Point = Point + 5 * Point / 6 ;
  334. }
  335. if(rvtop == 1 || rakantop == 1 || rakanbot == 1){
  336. Point = Point + 3 * Point / 4;
  337. }
  338. }
  339. if(ysbot == 2 && leetop == 1 && ystop == 0 && leebot == 1 ){
  340. if(rvtop == 0 && yibot == 0 && yitop == 0){
  341. Point = Point + 5 * Point / 6 ;
  342. }
  343. if(rvtop == 1 || yibot == 1 && yitop == 1 ){
  344. Point = Point + 3 * Point / 4;
  345. }
  346. }
  347. if(ysbot == 2 && leebot == 1 && ystop == 0 && leetop == 1 ){
  348. if(rvtop == 0 && yitop == 0 && yibot == 0){
  349. Point = Point + 5 * Point / 6 ;
  350. }
  351. if(rvtop == 1 || yitop == 1 || yibot == 1){
  352. Point = Point + 3 * Point / 4;
  353. }
  354. }
  355. if(leetop == 2 && xayahtop == 1 && leebot == 0 && xayahbot == 1 ){
  356. if(yibot == 0 && rakanbot == 0 && rakantop == 0){
  357. Point = Point + 5 * Point / 6 ;
  358. }
  359. if(yibot == 1 || rakanbot == 1 || rakantop == 1){
  360. Point = Point + 3 * Point / 4;
  361. }
  362. }
  363. if(leebot == 2 && xayahbot == 1 && leetop == 0 && xayahtop == 1 ){
  364. if(yitop == 0 && rakantop == 0 && rakanbot == 0){
  365. Point = Point + 5 * Point / 6 ;
  366. }
  367. if(yitop == 1 || rakantop == 1 || rakanbot == 1){
  368. Point = Point + 3 * Point / 4;
  369. }
  370. }
  371. if(leetop == 2 && xayahbot == 1 && leebot == 0 && xayahtop == 1 ){
  372. if(yibot == 0 && rakantop == 0 && rakanbot == 0){
  373. Point = Point + 5 * Point / 6 ;
  374. }
  375. if(yibot == 1 || rakantop == 1 || rakanbot == 1){
  376. Point = Point + 3 * Point / 4;
  377. }
  378. }
  379. if(leebot == 2 && xayahtop == 1 && leetop == 0 && xayahbot == 1 ){
  380. if(yitop == 0 && rakanbot == 0 && rakantop == 0){
  381. Point = Point + 5 * Point / 6 ;
  382. }
  383. if(yitop == 1 || rakanbot == 1 || rakantop == 1){
  384. Point = Point + 3 * Point / 4;
  385. }
  386. }
  387. if(leetop + leebot == 3){
  388. if(yitop == 0 && yibot == 0){
  389. Point *= 3;
  390. }
  391. if(yitop == 1|| yibot == 1){
  392. Point /=4 ;
  393. }
  394. }
  395. if(xayahtop + xayahbot == 3){
  396. if(rakantop == 0 && rakanbot == 0){
  397. Point *= 3;
  398. }
  399. if(rakantop == 1|| rakanbot == 1){
  400. Point /=4 ;
  401. }
  402. }
  403. if(ystop + ysbot == 3){
  404. if(rvtop == 0 && rvbot == 0){
  405. Point *= 3;
  406. }
  407. if(rvtop == 1|| rvbot == 1){
  408. Point /= 4 ;
  409. }
  410. }
  411. if(ystop + ysbot == 2){
  412. if(rvtop == 1|| rvbot == 1){
  413. Point /=3 ;
  414. }
  415. }
  416. if(xayahtop + xayahbot == 2){
  417. if(rakantop == 1|| rakanbot == 1){
  418. Point /=3 ;
  419. }
  420. }
  421. if(leetop + leebot == 2){
  422. if(yitop == 1|| yibot == 1){
  423. Point /= 3 ;
  424. }
  425. }
  426. if(ystop + ysbot >= 5) Point = 0;
  427. if(ystop + ysbot == 4) Point *=4;
  428. if(ystop + ysbot == 3) Point *= 3;
  429. if(xayahtop + xayahbot >= 5) Point = 0;
  430. if(xayahtop + xayahbot == 4) Point *= 4;
  431. if(xayahtop + xayahbot == 3) Point *= 3;
  432. if(leetop + leebot >= 5) Point = 0;
  433. if(leetop + leebot == 4) Point *= 4;
  434. if(leetop + leebot == 3) Point *= 3;
  435. return Point;
  436. }
  437. int defend(int i,int j){
  438. int Point=0;
  439. //HANG NGANG
  440. int ystop = 0, rvtop = 0, ysbot = 0, rvbot = 0;
  441. //Trai
  442. for(int m = 1; m < 6 && j - 2 * m >= 0; m++){
  443. if(a[i][j - 2 * m] == Honloan){
  444. ystop++;
  445. break;
  446. }
  447. if(a[i][j - 2 * m] == Trattu){
  448. rvtop++;
  449. }
  450. if(a[i][j - 2 * m] == 0){
  451. break;
  452. }
  453. }
  454. //Phai
  455. for(int m = 1; m < 6 && j + 2 * m <= 28;m++){
  456. if(a[i][j + 2 * m] == Honloan){
  457. ysbot++;
  458. break;
  459. }
  460. if(a[i][j + 2 * m] == Trattu){
  461. rvbot++;
  462. }
  463. if(a[i][j + 2 * m] == 0){
  464. break;
  465. }
  466. }
  467. //Cheo huyen
  468. int xayahtop = 0, rakantop = 0, veigarmid = 0, xayahbot = 0, rakanbot = 0;
  469. //Duoi len
  470. for(int m = 1; m < 6 && i - m >= 0 && j - m >= 0;m++){
  471. if(a[i - m][j - m] == Honloan) {
  472. xayahtop++;
  473. break;
  474. }
  475. if(a[i - m][j - m] == Trattu){
  476. rakantop++;
  477. }
  478. if(a[i - m][j - m] == 0){
  479. break;
  480. }
  481. }
  482. //Tren xuong
  483. for(int m = 1; m < 6 && i + m <= 10 && j + m <= 28; m++){
  484. if(a[i + m][j + m] == Honloan) {
  485. xayahbot++;
  486. break;
  487. }
  488. if(a[i + m][j + m] == Trattu){
  489. rakanbot++;
  490. }
  491. if(a[i + m][j + m] == 0){
  492. break;
  493. }
  494. }
  495. //Cheo sac
  496. int leetop = 0, yitop = 0, leebot = 0, yibot = 0;
  497. //Duoilen
  498. for(int m = 1; m < 6 && i - m >= 0 && j + m <= 28 ; m++){
  499. if(a[i - m][j + m] == Honloan){
  500. leetop++;
  501. break;
  502. }
  503. if(a[i - m][j + m] == Trattu){
  504. yitop++;
  505. }
  506. if(a[i - m][j + m] == 0){
  507. break;
  508. }
  509. }
  510. //Trenxuong
  511. for(int m = 1; m < 6 && i + m <= 10 && j - m >= 0; m++){
  512. if(a[i + m][j - m] == Honloan){
  513. leebot++;
  514. break;
  515. }
  516. if(a[i + m][j - m] == Trattu){
  517. yibot++;
  518. }
  519. if(a[i + m][j - m] == 0){
  520. break;
  521. }
  522. }
  523. if(ystop + ysbot == 2){
  524. Point += 0;
  525. }
  526. else{
  527. Point += DEF[rvtop + rvbot];
  528. }
  529. if(leetop + leebot == 2){
  530. Point += 0;
  531. }
  532. else{
  533. Point += DEF[yitop + yibot];
  534. }
  535. if(xayahtop + xayahbot == 2){
  536. Point += 0;
  537. }
  538. else{
  539. Point += DEF[rakantop + rakanbot];
  540. }
  541. if(rvtop == 2 && rakantop == 2 && rvbot == 0 && rakanbot == 0 ){
  542. if(ysbot == 0 && xayahbot == 0 ){
  543. Point = Point + 4 * Point / 5 ;
  544. }
  545. if(ysbot == 1 || xayahbot == 1){
  546. Point = Point + 2 * Point / 3;
  547. }
  548. }
  549. if(rvtop == 2 && rakanbot == 2 && rvbot == 0 && rakantop == 0 ){
  550. if(ysbot == 0 && xayahtop == 0 ){
  551. Point = Point + 4 * Point / 5 ;
  552. }
  553. if(ysbot == 1 || xayahtop == 1){
  554. Point = Point + 2 * Point / 3;
  555. }
  556. }
  557. if(rvtop == 2 && yitop == 2 && rvbot == 0 && yibot == 0 ){
  558. if(ysbot == 0 && leebot == 0 ){
  559. Point = Point + 4 * Point / 5 ;
  560. }
  561. if(ysbot == 1 || leebot == 1){
  562. Point = Point + 2 * Point / 3;
  563. }
  564. }
  565. if(rvtop == 2 && yibot == 2 && rvbot == 0 && yitop == 0 ){
  566. if(ysbot == 0 && leetop == 0 ){
  567. Point = Point + 4 * Point / 5 ;
  568. }
  569. if(ysbot == 1 || leetop == 1){
  570. Point = Point + 2 * Point / 3;
  571. }
  572. }
  573. if(rvbot == 2 && rakantop == 2 && rvtop == 0 && rakanbot == 0 ){
  574. if(ystop == 0 && xayahbot == 0 ){
  575. Point = Point + 4 * Point / 5 ;
  576. }
  577. if(ystop == 1 || xayahbot == 1){
  578. Point = Point + 2 * Point / 3;
  579. }
  580. }
  581. if(rvbot == 2 && rakanbot == 2 && rvtop == 0 && rakantop == 0 ){
  582. if(ystop == 0 && xayahtop == 0 ){
  583. Point = Point + 4 * Point / 5 ;
  584. }
  585. if(ystop == 1 || xayahtop == 1){
  586. Point = Point + 2 * Point / 3;
  587. }
  588. }
  589. if(rvbot == 2 && yitop == 2 && rvtop == 0 && yibot == 0 ){
  590. if(ystop == 0 && leebot == 0 ){
  591. Point = Point + 4 * Point / 5 ;
  592. }
  593. if(ystop == 1 || leebot == 1){
  594. Point = Point + 2 * Point / 3;
  595. }
  596. }
  597. if(rvbot == 2 && yibot == 2 && rvtop == 0 && yitop == 0 ){
  598. if(ystop == 0 && leetop == 0 ){
  599. Point = Point + 4 * Point / 5 ;
  600. }
  601. if(ystop == 1 || leetop == 1){
  602. Point = Point + 2 * Point / 3;
  603. }
  604. }
  605. if(yitop == 2 && rakantop == 2 && yibot == 0 && rakanbot == 0 ){
  606. if(leebot == 0 && xayahbot == 0 ){
  607. Point = Point + 4 * Point / 5 ;
  608. }
  609. if(leebot == 1 || xayahbot == 1){
  610. Point = Point + 2 * Point / 3;
  611. }
  612. }
  613. if(yibot == 2 && rakanbot == 2 && yitop == 0 && rakantop == 0 ){
  614. if(leetop == 0 && xayahtop == 0 ){
  615. Point = Point + 4 * Point / 5 ;
  616. }
  617. if(leetop == 1 || xayahtop == 1){
  618. Point = Point + 2 * Point / 3;
  619. }
  620. }
  621. if(yitop == 2 && rakanbot == 2 && yibot == 0 && rakantop == 0 ){
  622. if(leebot == 0 && xayahtop == 0 ){
  623. Point = Point + 4 * Point / 5 ;
  624. }
  625. if(leebot == 1 || xayahtop == 1){
  626. Point = Point + 2 * Point / 3;
  627. }
  628. }
  629. if(yibot == 2 && rakantop == 2 && yitop == 0 && rakanbot == 0 ){
  630. if(leetop == 0 && xayahbot == 0 ){
  631. Point = Point + 4 * Point / 5 ;
  632. }
  633. if(leetop == 1 || xayahbot == 1){
  634. Point = Point + 2 * Point / 3;
  635. }
  636. }
  637. if(rvtop == 1 && rakantop == 2 && rvbot == 1 && rakanbot == 0 ){
  638. if(ysbot == 0 && xayahbot == 0 && ystop == 0){
  639. Point = Point + 4 * Point / 5 ;
  640. }
  641. if(ysbot == 1 || xayahbot == 1 || ystop == 1){
  642. Point = Point + 2 * Point / 3;
  643. }
  644. }
  645. if(rvtop == 1 && rakanbot == 2 && rvbot == 1 && rakantop == 0 ){
  646. if(ysbot == 0 && xayahtop == 0 && ystop == 0 ){
  647. Point = Point + 4 * Point / 5 ;
  648. }
  649. if(ysbot == 1 || xayahtop == 1 || ystop == 1){
  650. Point = Point + 2 * Point / 3;
  651. }
  652. }
  653. if(rvtop == 1 && yitop == 2 && rvbot == 1 && yibot == 0 ){
  654. if(ysbot == 0 && leebot == 0 && ystop == 0){
  655. Point = Point + 4 * Point / 5 ;
  656. }
  657. if(ysbot == 1 || leebot == 1 || ystop == 1){
  658. Point = Point + 2 * Point / 3;
  659. }
  660. }
  661. if(rvtop == 1 && yibot == 2 && rvbot == 1 && yitop == 0 ){
  662. if(ysbot == 0 && leetop == 0 && ystop == 0 ){
  663. Point = Point + 4 * Point / 5 ;
  664. }
  665. if(ysbot == 1 || leetop == 1 || ystop == 1){
  666. Point = Point + 2 * Point / 3;
  667. }
  668. }
  669. if(rvbot == 1 && rakantop == 2 && rvtop == 1 && rakanbot == 0 ){
  670. if(ystop == 0 && xayahbot == 0 && ysbot == 0){
  671. Point = Point + 4 * Point / 5 ;
  672. }
  673. if(ystop == 1 || xayahbot == 1 || ysbot == 1){
  674. Point = Point + 2 * Point / 3;
  675. }
  676. }
  677. if(rvbot == 1 && rakanbot == 2 && rvtop == 1 && rakantop == 0 ){
  678. if(ystop == 0 && xayahtop == 0 && ysbot == 0){
  679. Point = Point + 4 * Point / 5 ;
  680. }
  681. if(ystop == 1 || xayahtop == 1 || ysbot == 1){
  682. Point = Point + 2 * Point / 3;
  683. }
  684. }
  685. if(rvbot == 1 && yitop == 2 && rvtop == 1 && yibot == 0 ){
  686. if(ystop == 0 && leebot == 0 && ysbot == 0 ){
  687. Point = Point + 4 * Point / 5 ;
  688. }
  689. if(ystop == 1 || leebot == 1 || ysbot == 1){
  690. Point = Point + 2 * Point / 3;
  691. }
  692. }
  693. if(rvbot == 1 && yibot == 2 && rvtop == 1 && yitop == 0 ){
  694. if(ystop == 0 && leetop == 0 && ysbot == 0 ){
  695. Point = Point + 4 * Point / 5 ;
  696. }
  697. if(ystop == 1 || leetop == 1 || ysbot == 1){
  698. Point = Point + 2 * Point / 3;
  699. }
  700. }
  701. if(yitop == 1 && rakantop == 2 && yibot == 1 && rakanbot == 0 ){
  702. if(leebot == 0 && xayahbot == 0 && leetop == 0){
  703. Point = Point + 4 * Point / 5 ;
  704. }
  705. if(leebot == 1 || xayahbot == 1 || leetop == 1){
  706. Point = Point + 2 * Point / 3;
  707. }
  708. }
  709. if(yibot == 1 && rakanbot == 2 && yitop == 1 && rakantop == 0 ){
  710. if(leetop == 0 && xayahtop == 0 && leebot == 0 ){
  711. Point = Point + 4 * Point / 5 ;
  712. }
  713. if(leetop == 1 || xayahtop == 1 || leebot == 1 ){
  714. Point = Point + 2 * Point / 3;
  715. }
  716. }
  717. if(yitop == 1 && rakanbot == 2 && yibot == 1 && rakantop == 0 ){
  718. if(leebot == 0 && xayahtop == 0 && leetop == 0 ){
  719. Point = Point + 4 * Point / 5 ;
  720. }
  721. if(leebot == 1 || xayahtop == 1 || leetop == 1){
  722. Point = Point + 2 * Point / 3;
  723. }
  724. }
  725. if(yibot == 1 && rakantop == 2 && yitop == 1 && rakanbot == 0 ){
  726. if(leetop == 0 && xayahbot == 0 && leebot == 0){
  727. Point = Point + 4 * Point / 5 ;
  728. }
  729. if(leetop == 1 || xayahbot == 1 || leebot == 1){
  730. Point = Point + 2 * Point / 3;
  731. }
  732. }
  733. if(rvtop == 2 && rakantop == 1 && rvbot == 0 && rakanbot == 1 ){
  734. if(ysbot == 0 && xayahbot == 0 && xayahtop == 0 ){
  735. Point = Point + 4 * Point / 5 ;
  736. }
  737. if(ysbot == 1 || xayahbot == 1 || xayahtop == 1 ){
  738. Point = Point + 2 * Point / 3;
  739. }
  740. }
  741. if(rvtop == 2 && rakanbot == 1 && rvbot == 0 && rakantop == 1 ){
  742. if(ysbot == 0 && xayahtop == 0 && xayahbot == 0 ){
  743. Point = Point + 4 * Point / 5 ;
  744. }
  745. if(ysbot == 1 || xayahtop == 1 || xayahbot == 1){
  746. Point = Point + 2 * Point / 3;
  747. }
  748. }
  749. if(rvtop == 2 && yitop == 1 && rvbot == 0 && yibot == 1 ){
  750. if(ysbot == 0 && leebot == 0 && leetop == 0){
  751. Point = Point + 4 * Point / 5 ;
  752. }
  753. if(ysbot == 1 || leebot == 1 || leetop == 1){
  754. Point = Point + 2 * Point / 3;
  755. }
  756. }
  757. if(rvtop == 2 && yibot == 1 && rvbot == 0 && yitop == 1 ){
  758. if(ysbot == 0 && leetop == 0 && leebot == 0 ){
  759. Point = Point + 4 * Point / 5 ;
  760. }
  761. if(ysbot == 1 || leetop == 1 || leebot == 1){
  762. Point = Point + 2 * Point / 3;
  763. }
  764. }
  765. if(rvbot == 2 && rakantop == 1 && rvtop == 0 && rakanbot == 1 ){
  766. if(ystop == 0 && xayahbot == 0 && xayahtop == 0){
  767. Point = Point + 4 * Point / 5 ;
  768. }
  769. if(ystop == 1 || xayahbot == 1 || xayahtop == 1){
  770. Point = Point + 2 * Point / 3;
  771. }
  772. }
  773. if(rvbot == 2 && rakanbot == 1 && rvtop == 0 && rakantop == 1 ){
  774. if(ystop == 0 && xayahtop == 0 && xayahbot == 0 ){
  775. Point = Point + 4 * Point / 5 ;
  776. }
  777. if(ystop == 1 || xayahtop == 1 || xayahbot == 1){
  778. Point = Point + 2 * Point / 3;
  779. }
  780. }
  781. if(rvbot == 2 && yitop == 1 && rvtop == 0 && yibot == 1 ){
  782. if(ystop == 0 && leebot == 0 && leetop == 0){
  783. Point = Point + 4 * Point / 5 ;
  784. }
  785. if(ystop == 1 || leebot == 1 && leetop == 1 ){
  786. Point = Point + 2 * Point / 3;
  787. }
  788. }
  789. if(rvbot == 2 && yibot == 1 && rvtop == 0 && yitop == 1 ){
  790. if(ystop == 0 && leetop == 0 && leebot == 0){
  791. Point = Point + 4 * Point / 5 ;
  792. }
  793. if(ystop == 1 || leetop == 1 || leebot == 1){
  794. Point = Point + 2 * Point / 3;
  795. }
  796. }
  797. if(yitop == 2 && rakantop == 1 && yibot == 0 && rakanbot == 1 ){
  798. if(leebot == 0 && xayahbot == 0 && xayahtop == 0){
  799. Point = Point + 4 * Point / 5 ;
  800. }
  801. if(leebot == 1 || xayahbot == 1 || xayahtop == 1){
  802. Point = Point + 2 * Point / 3;
  803. }
  804. }
  805. if(yibot == 2 && rakanbot == 1 && yitop == 0 && rakantop == 1 ){
  806. if(leetop == 0 && xayahtop == 0 && xayahbot == 0){
  807. Point = Point + 4 * Point / 5 ;
  808. }
  809. if(leetop == 1 || xayahtop == 1 || xayahbot == 1){
  810. Point = Point + 2 * Point / 3;
  811. }
  812. }
  813. if(yitop == 2 && rakanbot == 1 && yibot == 0 && rakantop == 1 ){
  814. if(leebot == 0 && xayahtop == 0 && xayahbot == 0){
  815. Point = Point + 4 * Point / 5 ;
  816. }
  817. if(leebot == 1 || xayahtop == 1 || xayahbot == 1){
  818. Point = Point + 2 * Point / 3;
  819. }
  820. }
  821. if(yibot == 2 && rakantop == 1 && yitop == 0 && rakanbot == 1 ){
  822. if(leetop == 0 && xayahbot == 0 && xayahtop == 0){
  823. Point = Point + 4 * Point / 5 ;
  824. }
  825. if(leetop == 1 || xayahbot == 1 || xayahtop == 1){
  826. Point = Point + 2 * Point / 3;
  827. }
  828. }
  829. if(yitop + yibot == 3){
  830. if(leetop == 0 && leebot == 0){
  831. Point *= 2;
  832. }
  833. if(leetop == 1|| leebot == 1){
  834. Point /=4 ;
  835. }
  836. }
  837. if(rakantop + rakanbot == 3){
  838. if(xayahtop == 0 && xayahbot == 0){
  839. Point *= 2;
  840. }
  841. if(xayahtop == 1|| xayahbot == 1){
  842. Point /=4 ;
  843. }
  844. }
  845. if(rvtop + rvbot == 3){
  846. if(ystop == 0 && ysbot == 0){
  847. Point *= 2;
  848. }
  849. if(ystop == 1|| ysbot == 1){
  850. Point /= 4 ;
  851. }
  852. }
  853. if(yitop + yibot > 0){
  854. Point -= ATT[leetop + leebot];
  855. }
  856. if(rvtop + rvbot > 0){
  857. Point -= ATT[ystop + ysbot];
  858. }
  859. if(rakantop + rakanbot > 0){
  860. Point -= ATT[xayahtop + xayahbot];
  861. }
  862. return Point;
  863. }
  864. void Fight(){
  865. for(int m = 0;m <= 10; m++){
  866. if(m % 2 == 0){
  867. for(int n = 0;n <= 28; n += 2){
  868. if(a[m][n] != 0){
  869. b[m][n] = 0;
  870. }
  871. else{
  872. b[m][n]+=attack(m,n)+defend(m,n);
  873. }
  874. }
  875. }
  876. else{
  877. for(int n = 1;n <= 27;n += 2){
  878. if(a[m][n] != 0){
  879. b[m][n] = 0;
  880. }
  881. else{
  882. b[m][n]+=attack(m,n)+defend(m,n);
  883. }
  884. }
  885. }
  886. }
  887. }
  888. void showdiem(){
  889. for(int i=0;i<=10;i++){
  890. if(i%2==0){
  891. for(int j=0;j<=28;j+=2){
  892. if(b[i][j]==0){
  893. }
  894. printf("%3d ",b[i][j]);
  895. }
  896. }
  897. else{
  898. for(int j=1;j<=27;j+=2){
  899. printf(" %3d",b[i][j]);
  900. }
  901. }
  902. cout<<endl;
  903. }
  904. }
  905. int bestYS(){
  906. int x = 0,y = 0,gg = 0;
  907. for(int i = 0; i <= 10; i++){
  908. if(i % 2 == 0){
  909. for(int j = 0;j <= 28; j+=2){
  910. if(b[i][j] >= gg){
  911. x = i;y = j;gg = b[i][j];
  912. }
  913. }
  914. }
  915. else{
  916. for(int j = 1;j <= 27; j+=2){
  917. if(b[i][j] >= gg){
  918. x = i;y = j;gg = b[i][j];
  919. }
  920. }
  921. }
  922. }
  923. a[x][y]=Honloan;
  924. return x*15+y/2;
  925. }
  926. void showdiem2(){
  927. for(int i=0;i<=10;i++){
  928. if(i%2==0){
  929. for(int j=0;j<=28;j+=2){
  930. printf("%3d ",a[i][j]);
  931. }
  932. }
  933. else{
  934. for(int j=1;j<=27;j+=2){
  935. printf(" %3d",a[i][j]);
  936. }
  937. }
  938. cout<<endl;
  939. }
  940. }
  941. int main(){
  942. int Move = 0;
  943. for(int i = 0;i <= 10; i++){
  944. if(i % 2 == 0){
  945. for(int j = 0;j <= 28; j+=2){
  946. cin>>a[i][j];
  947. if(a[i][j] > 0) Move++;
  948. }
  949. }
  950. else{
  951. for(int j = 0;j <= 26; j+=2){
  952. cin>>a[i][j + 1];
  953. if(a[i][j + 1] > 0) Move++;
  954. }
  955. }
  956. }
  957. if(Move == 0){
  958. cout<<"82";
  959. return 0;
  960. }
  961. else{
  962. if(Move % 2 == 0){
  963. Honloan = 1;
  964. Trattu = 2;
  965. }
  966. else{
  967. Honloan = 2;
  968. Trattu = 1;
  969. }
  970. }
  971. Welcometosummonerrift();
  972. Fight();
  973. //showdiem();
  974. cout<<bestYS()<<endl;
  975. showdiem2();
  976. }
Success #stdin #stdout 0s 15248KB
stdin
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 1 1 1 1 2 0 0 0 0 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 1 2 2 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
stdout
141
  0    0    0    0    0    0    0    0    0    0    0    0    0    0    0  
    0    0    0    0    0    0    0    0    0    0    0    0    0    0
  0    0    0    0    0    0    0    0    0    0    0    0    0    0    0  
    0    0    0    0    0    0    0    0    0    0    0    0    0    0
  0    0    0    0    0    0    0    0    2    0    0    0    0    0    0  
    0    0    0    0    0    0    0    1    0    0    0    0    0    0
  0    0    0    0    0    2    1    1    1    1    2    0    0    0    0  
    0    0    0    0    0    0    1    1    2    0    0    0    0    0
  0    0    0    0    0    0    1    2    2    0    0    0    0    0    0  
    0    0    0    0    0    2    1    2    0    0    0    0    0    0
  0    0    0    0    0    0    0    0    0    0    0    0    0    0    0