814B - An express train to reveries ——暴力枚举

谁践踏了优雅 2022-06-14 03:41 227阅读 0赞

Think:
1题意:输入两个序列,判断原始序列,原始序列与输入的两个序列最多只有1个对应元素不相等,且原始序列不会出现重复元素,序列长度2 ≤ n ≤ 1 000,元素范围1 ≤ ai ≤ n
2思路:暴力枚举两种情况(因为原始序列不重复,且输入的序列与原始序列最多只有一个元素对应不相等,因此可以两个输入序列最多只有两个元素对应不相等,然后将未出现的至多两个元素不同顺序放进去,进而之多产生两种可能的原始序列),再判断符合对应元素不相等的个数小于等于1的条件
3感悟:桶思想——建立数组下标与元素大小的关系

B. An express train to reveries
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Sengoku still remembers the mysterious “colourful meteoroids” she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.

On that night, Sengoku constructed a permutation p1, p2, …, pn of integers from 1 to n inclusive, with each integer representing a colour, wishing for the colours to see in the coming meteor outburst. Two incredible outbursts then arrived, each with n meteorids, colours of which being integer sequences a1, a2, …, an and b1, b2, …, bn respectively. Meteoroids’ colours were also between 1 and n inclusive, and the two sequences were not identical, that is, at least one i (1 ≤ i ≤ n) exists, such that ai ≠ bi holds.

Well, she almost had it all — each of the sequences a and b matched exactly n - 1 elements in Sengoku’s permutation. In other words, there is exactly one i (1 ≤ i ≤ n) such that ai ≠ pi, and exactly one j (1 ≤ j ≤ n) such that bj ≠ pj.

For now, Sengoku is able to recover the actual colour sequences a and b through astronomical records, but her wishes have been long forgotten. You are to reconstruct any possible permutation Sengoku could have had on that night.
Input

The first line of input contains a positive integer n (2 ≤ n ≤ 1 000) — the length of Sengoku’s permutation, being the length of both meteor outbursts at the same time.

The second line contains n space-separated integers a1, a2, …, an (1 ≤ ai ≤ n) — the sequence of colours in the first meteor outburst.

The third line contains n space-separated integers b1, b2, …, bn (1 ≤ bi ≤ n) — the sequence of colours in the second meteor outburst. At least one i (1 ≤ i ≤ n) exists, such that ai ≠ bi holds.
Output

Output n space-separated integers p1, p2, …, pn, denoting a possible permutation Sengoku could have had. If there are more than one possible answer, output any one of them.

Input guarantees that such permutation exists.
Examples
Input

5
1 2 3 4 3
1 2 5 4 5

Output

1 2 5 4 3

Input

5
4 4 2 3 1
5 4 5 3 1

Output

5 4 2 3 1

Input

4
1 1 3 4
1 4 3 4

Output

1 2 3 4

Note

In the first sample, both 1, 2, 5, 4, 3 and 1, 2, 3, 4, 5 are acceptable outputs.

In the second sample, 5, 4, 2, 3, 1 is the only permutation to satisfy the constraints.

以下为Accepted代码

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int op, tp, link[4];
  4. int main(){
  5. int n, i, a[1004], b[1004], c[1004], d[1004];
  6. bool v[1004];
  7. while(scanf("%d", &n) != EOF){
  8. tp = 0;
  9. memset(v, false, sizeof(v));
  10. memset(c, -1, sizeof(c));
  11. for(i = 0; i < n; i++)
  12. scanf("%d", &a[i]);
  13. for(i = 0; i < n; i++){
  14. scanf("%d", &b[i]);
  15. if(a[i] == b[i] && !v[a[i]]){
  16. v[a[i]] = true;
  17. c[i] = d[i] = a[i];
  18. }
  19. }
  20. for(i = 1; i <= n; i++){
  21. if(!v[i]){
  22. link[tp++] = i;
  23. }
  24. }
  25. op = 0;
  26. for(i = 0; i < n; i++){
  27. if(c[i] == -1){
  28. c[i] = link[op++];
  29. tp--;
  30. d[i] = link[tp];
  31. }
  32. }
  33. int cnt1 = 0, cnt2 = 0;
  34. for(i = 0; i < n; i++){
  35. if(c[i] != a[i])
  36. cnt1++;
  37. if(c[i] != b[i])
  38. cnt2++;
  39. }
  40. if(cnt1 <= 1 && cnt2 <= 1){
  41. for(i = 0; i < n; i++)
  42. printf("%d%c", c[i], i == n-1? '\n': ' ');
  43. }
  44. else {
  45. for(i = 0; i < n; i++)
  46. printf("%d%c", d[i], i == n-1? '\n': ' ');
  47. }
  48. }
  49. return 0;
  50. }

以下为测试数据

  1. Judgement Protocol
  2. Test: #1, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  3. Input
  4. 5
  5. 1 2 3 4 3
  6. 1 2 5 4 5
  7. Output
  8. 1 2 3 4 5
  9. Answer
  10. 1 2 5 4 3
  11. Checker Log
  12. ok Correct ^ ^
  13. Test: #2, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  14. Input
  15. 5
  16. 4 4 2 3 1
  17. 5 4 5 3 1
  18. Output
  19. 5 4 2 3 1
  20. Answer
  21. 5 4 2 3 1
  22. Checker Log
  23. ok Correct ^ ^
  24. Test: #3, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  25. Input
  26. 4
  27. 1 1 3 4
  28. 1 4 3 4
  29. Output
  30. 1 2 3 4
  31. Answer
  32. 1 2 3 4
  33. Checker Log
  34. ok Correct ^ ^
  35. Test: #4, time: 15 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  36. Input
  37. 10
  38. 1 2 3 4 7 6 7 8 9 10
  39. 1 2 3 4 5 6 5 8 9 10
  40. Output
  41. 1 2 3 4 5 6 7 8 9 10
  42. Answer
  43. 1 2 3 4 5 6 7 8 9 10
  44. Checker Log
  45. ok Correct ^ ^
  46. Test: #5, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  47. Input
  48. 10
  49. 1 2 3 4 5 6 7 8 7 10
  50. 1 2 3 4 5 6 7 8 9 9
  51. Output
  52. 1 2 3 4 5 6 7 8 9 10
  53. Answer
  54. 1 2 3 4 5 6 7 8 9 10
  55. Checker Log
  56. ok Correct ^ ^
  57. Test: #6, time: 15 ms., memory: 4 KB, exit code: 0, checker exit code: 0, verdict: OK
  58. Input
  59. 10
  60. 1 2 3 4 5 6 7 8 4 10
  61. 1 2 3 4 5 6 7 6 9 10
  62. Output
  63. 1 2 3 4 5 6 7 8 9 10
  64. Answer
  65. 1 2 3 4 5 6 7 8 9 10
  66. Checker Log
  67. ok Correct ^ ^
  68. Test: #7, time: 15 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  69. Input
  70. 10
  71. 8 6 1 7 9 3 5 2 10 9
  72. 8 6 1 7 4 3 5 2 10 4
  73. Output
  74. 8 6 1 7 4 3 5 2 10 9
  75. Answer
  76. 8 6 1 7 4 3 5 2 10 9
  77. Checker Log
  78. ok Correct ^ ^
  79. Test: #8, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  80. Input
  81. 10
  82. 2 9 7 7 8 5 4 10 6 1
  83. 2 8 7 3 8 5 4 10 6 1
  84. Output
  85. 2 9 7 3 8 5 4 10 6 1
  86. Answer
  87. 2 9 7 3 8 5 4 10 6 1
  88. Checker Log
  89. ok Correct ^ ^
  90. Test: #9, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  91. Input
  92. 500
  93. 346 422 445 172 378 34 209 410 119 444 279 222 65 414 228 385 386 427 75 178 243 19 27 488 127 467 94 153 162 46 379 334 238 225 301 7 234 271 68 241 406 257 483 302 419 45 329 55 300 124 203 305 282 106 442 371 129 36 183 431 166 437 76 403 50 469 404 288 58 89 370 205 407 196 52 323 110 366 37 230 353 493 214 169 457 318 413 120 207 274 314 18 66 8 486 14 485 421 461 396 310 393 272 143 328 199 57 202 104 325 480 358 471 99 111 307 236 331 446 281 268 362 336 344 324 428 47 40 48 53 286 150 273 70 3...
  94. Output
  95. 346 422 445 172 378 34 209 410 119 444 279 222 65 414 228 385 386 427 75 178 243 19 27 488 127 467 94 153 162 46 379 334 238 225 301 7 234 271 68 241 406 257 483 302 419 45 329 55 300 124 203 305 282 106 442 371 129 36 183 431 166 437 76 403 50 469 404 288 58 89 370 205 407 196 52 323 110 366 37 230 353 493 214 169 457 318 413 120 207 274 314 18 66 8 486 14 485 421 461 396 310 393 272 143 328 199 57 202 104 325 480 358 471 99 111 307 236 331 446 281 268 362 336 344 324 428 47 40 48 53 286 150 273 70 327 13...
  96. Answer
  97. 346 422 445 172 378 34 209 410 119 444 279 222 65 414 228 385 386 427 75 178 243 19 27 488 127 467 94 153 162 46 379 334 238 225 301 7 234 271 68 241 406 257 483 302 419 45 329 55 300 124 203 305 282 106 442 371 129 36 183 431 166 437 76 403 50 469 404 288 58 89 370 205 407 196 52 323 110 366 37 230 353 493 214 169 457 318 413 120 207 274 314 18 66 8 486 14 485 421 461 396 310 393 272 143 328 199 57 202 104 325 480 358 471 99 111 307 236 331 446 281 268 362 336 344 324 428 47 40 48 53 286 150 273 70 327 13...
  98. Checker Log
  99. ok Correct ^ ^
  100. Test: #10, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  101. Input
  102. 1000
  103. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 440 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 1...
  104. Output
  105. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...
  106. Answer
  107. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...
  108. Checker Log
  109. ok Correct ^ ^
  110. Test: #11, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  111. Input
  112. 2
  113. 2 2
  114. 1 1
  115. Output
  116. 1 2
  117. Answer
  118. 1 2
  119. Checker Log
  120. ok Correct ^ ^
  121. Test: #12, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  122. Input
  123. 3
  124. 1 2 2
  125. 1 3 3
  126. Output
  127. 1 2 3
  128. Answer
  129. 1 3 2
  130. Checker Log
  131. ok Correct ^ ^
  132. Test: #13, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  133. Input
  134. 3
  135. 2 2 3
  136. 1 2 1
  137. Output
  138. 1 2 3
  139. Answer
  140. 1 2 3
  141. Checker Log
  142. ok Correct ^ ^
  143. Test: #14, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  144. Input
  145. 3
  146. 1 3 3
  147. 1 1 3
  148. Output
  149. 1 2 3
  150. Answer
  151. 1 2 3
  152. Checker Log
  153. ok Correct ^ ^
  154. Test: #15, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  155. Input
  156. 3
  157. 2 1 1
  158. 2 3 3
  159. Output
  160. 2 1 3
  161. Answer
  162. 2 3 1
  163. Checker Log
  164. ok Correct ^ ^
  165. Test: #16, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  166. Input
  167. 3
  168. 3 3 2
  169. 1 1 2
  170. Output
  171. 1 3 2
  172. Answer
  173. 1 3 2
  174. Checker Log
  175. ok Correct ^ ^
  176. Test: #17, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  177. Input
  178. 3
  179. 1 3 3
  180. 3 3 2
  181. Output
  182. 1 3 2
  183. Answer
  184. 1 3 2
  185. Checker Log
  186. ok Correct ^ ^
  187. Test: #18, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  188. Input
  189. 4
  190. 3 2 3 4
  191. 1 2 1 4
  192. Output
  193. 1 2 3 4
  194. Answer
  195. 1 2 3 4
  196. Checker Log
  197. ok Correct ^ ^
  198. Test: #19, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  199. Input
  200. 4
  201. 2 2 3 4
  202. 1 2 3 2
  203. Output
  204. 1 2 3 4
  205. Answer
  206. 1 2 3 4
  207. Checker Log
  208. ok Correct ^ ^
  209. Test: #20, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  210. Input
  211. 4
  212. 1 2 4 4
  213. 2 2 3 4
  214. Output
  215. 1 2 3 4
  216. Answer
  217. 1 2 3 4
  218. Checker Log
  219. ok Correct ^ ^
  220. Test: #21, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  221. Input
  222. 4
  223. 4 1 3 4
  224. 2 1 3 2
  225. Output
  226. 2 1 3 4
  227. Answer
  228. 2 1 3 4
  229. Checker Log
  230. ok Correct ^ ^
  231. Test: #22, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  232. Input
  233. 4
  234. 3 2 1 3
  235. 4 2 1 2
  236. Output
  237. 4 2 1 3
  238. Answer
  239. 4 2 1 3
  240. Checker Log
  241. ok Correct ^ ^
  242. Test: #23, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  243. Input
  244. 4
  245. 1 4 1 3
  246. 2 4 1 4
  247. Output
  248. 2 4 1 3
  249. Answer
  250. 2 4 1 3
  251. Checker Log
  252. ok Correct ^ ^
  253. Test: #24, time: 0 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  254. Input
  255. 4
  256. 1 3 4 4
  257. 3 3 2 4
  258. Output
  259. 1 3 2 4
  260. Answer
  261. 1 3 2 4
  262. Checker Log
  263. ok Correct ^ ^
  264. Test: #25, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  265. Input
  266. 100
  267. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 41 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  268. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 28 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 ...
  269. Output
  270. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  271. Answer
  272. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  273. Checker Log
  274. ok Correct ^ ^
  275. Test: #26, time: 15 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  276. Input
  277. 997
  278. 309 225 598 599 353 132 597 350 273 519 85 977 51 384 452 834 761 256 702 861 136 920 349 642 774 777 155 991 815 42 43 181 315 798 553 804 54 740 839 911 635 108 953 105 163 340 746 981 357 482 297 573 756 984 966 168 493 547 764 148 937 758 397 370 22 388 197 733 323 334 101 221 114 343 445 930 171 6 721 568 454 867 66 39 266 4 290 294 208 747 448 962 824 572 919 455 95 347 975 291 708 952 150 282 477 669 835 485 933 44 973 253 671 144 94 29 229 86 627 212 757 143 501 305 980 355 576 860 20 56 375 6...
  279. Output
  280. 309 225 598 599 353 132 597 350 273 519 85 977 51 384 452 834 761 256 702 861 136 920 349 642 774 777 155 991 815 42 43 181 315 798 553 804 54 740 839 911 635 108 953 105 163 340 746 981 357 482 297 573 756 984 966 168 493 547 764 148 937 758 397 370 22 388 197 733 323 334 101 221 114 343 445 930 171 6 721 568 454 867 66 39 266 4 290 294 208 747 448 962 824 572 919 455 95 347 975 291 708 952 150 282 477 669 835 485 933 44 973 253 671 144 94 29 229 86 627 212 757 143 501 305 980 355 576 860 20 56 375 629 99...
  281. Answer
  282. 309 225 598 599 353 132 597 350 273 519 85 977 51 384 452 834 761 256 702 861 136 920 349 642 774 777 155 991 815 42 43 181 315 798 553 804 54 740 839 911 635 108 953 105 163 340 746 981 357 482 297 573 756 984 966 168 493 547 764 148 937 758 397 370 22 388 197 733 323 334 101 221 114 343 445 930 171 6 721 568 454 867 66 39 266 4 290 294 208 747 448 962 824 572 919 455 95 347 975 291 708 952 150 282 477 669 835 485 933 44 973 253 671 144 94 29 229 86 627 212 757 143 501 305 980 355 576 860 20 56 375 629 99...
  283. Checker Log
  284. ok Correct ^ ^
  285. Test: #27, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  286. Input
  287. 1000
  288. 59 615 47 121 265 619 776 404 556 783 348 417 57 440 112 152 419 293 262 110 328 973 989 273 55 41 590 267 278 523 504 921 264 239 869 756 584 162 130 336 644 697 226 257 801 194 774 968 449 297 557 574 94 12 54 181 271 933 286 979 462 207 390 133 817 992 938 35 766 488 163 704 354 323 999 447 787 459 382 374 770 638 50 806 963 46 37 623 797 9 335 742 737 127 694 617 682 845 145 477 710 380 838 715 599 446 332 236 23 405 900 641 886 100 955 942 917 344 318 512 549 312 809 892 799 169 438 319 22 637 7...
  289. Output
  290. 59 615 47 121 265 619 776 404 556 783 348 417 57 440 112 152 419 293 262 110 328 973 989 273 55 41 590 267 278 523 504 921 264 239 869 756 584 162 130 336 644 697 226 257 801 194 774 968 449 297 557 574 94 12 54 181 271 933 286 979 462 207 390 133 817 992 938 35 766 488 163 704 354 323 999 447 787 459 382 374 770 638 50 806 963 46 37 623 797 9 335 742 737 127 694 617 682 845 145 477 710 380 838 715 599 446 332 236 23 405 900 641 886 100 955 942 917 344 318 512 549 312 809 892 799 169 438 319 22 637 703 176...
  291. Answer
  292. 59 615 47 121 265 619 776 404 556 783 348 417 57 440 112 152 419 293 262 110 328 973 989 273 55 41 590 267 278 523 504 921 264 239 869 756 584 162 856 336 644 697 226 257 801 194 774 968 449 297 557 574 94 12 54 181 271 933 286 979 462 207 390 133 817 992 938 35 766 488 163 704 354 323 999 447 787 459 382 374 770 638 50 806 963 46 37 623 797 9 335 742 737 127 694 617 682 845 145 477 710 380 838 715 599 446 332 236 23 405 900 641 886 100 955 942 917 344 318 512 549 312 809 892 799 169 438 319 22 637 703 176...
  293. Checker Log
  294. ok Correct ^ ^
  295. Test: #28, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  296. Input
  297. 1000
  298. 909 600 221 766 834 874 872 231 696 801 164 124 335 591 953 451 200 492 531 345 113 980 774 326 562 671 35 500 603 706 922 984 354 141 809 85 269 427 5 739 320 921 937 502 956 239 137 796 125 624 14 353 483 182 38 838 761 460 179 845 620 153 202 473 175 719 149 621 526 268 212 948 165 535 541 901 784 480 736 807 658 364 109 73 698 494 176 857 416 93 21 65 132 193 769 101 111 951 36 810 324 734 381 978 674 800 462 408 866 717 484 390 919 48 783 42 368 229 292 854 487 103 903 435 663 186 831 806 799 62...
  299. Output
  300. 909 600 221 766 834 874 872 231 696 801 164 124 335 591 953 451 200 492 531 345 113 980 774 326 562 671 35 500 603 706 922 984 354 141 809 85 269 427 5 739 320 921 937 502 956 239 137 796 125 624 14 353 483 182 38 838 761 460 179 845 620 153 202 473 175 719 149 621 526 268 212 948 165 535 541 901 784 480 736 807 658 364 109 73 698 494 176 857 416 93 21 65 132 193 769 101 111 951 36 810 324 734 381 978 674 800 462 408 866 717 484 390 919 48 783 42 368 229 292 854 487 103 903 435 663 186 831 806 799 627 151 ...
  301. Answer
  302. 909 600 221 766 834 874 872 231 696 801 164 124 335 591 953 451 200 492 531 345 113 980 774 326 562 671 35 500 603 706 922 984 354 141 809 85 269 427 5 739 320 921 937 502 956 239 137 796 125 624 14 353 483 182 38 838 761 460 179 845 620 153 202 473 175 719 149 621 526 268 212 948 165 535 541 901 784 480 736 807 658 364 109 73 698 494 176 857 416 93 21 65 132 193 769 101 111 951 36 810 324 734 381 978 674 800 462 408 866 717 484 390 919 48 783 42 368 229 292 854 487 103 903 435 663 186 831 806 799 627 151 ...
  303. Checker Log
  304. ok Correct ^ ^
  305. Test: #29, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  306. Input
  307. 1000
  308. 283 699 619 182 607 82 537 768 961 778 996 737 409 19 565 636 149 526 734 359 133 845 622 876 124 903 430 726 389 958 302 797 323 501 433 914 391 708 398 798 733 879 488 61 138 74 38 589 579 80 523 203 921 902 752 599 627 472 646 675 479 759 205 327 452 163 113 727 559 812 151 179 438 94 76 159 218 881 469 566 442 392 450 500 289 528 895 468 423 412 856 612 115 519 928 624 723 195 918 401 132 255 214 328 546 314 634 202 748 108 164 816 991 22 843 147 524 735 658 63 839 720 175 847 373 506 679 199 334...
  309. Output
  310. 283 699 619 182 607 82 537 768 961 778 996 737 409 19 565 636 149 526 734 359 133 845 622 876 124 903 430 726 389 958 302 797 323 501 433 914 391 708 398 798 733 879 488 61 138 74 38 589 579 80 523 203 921 902 752 599 627 472 646 675 479 759 205 327 452 163 113 727 559 812 151 179 438 94 76 159 218 881 469 566 442 392 450 500 289 528 895 468 423 412 856 612 115 519 928 624 723 195 918 401 132 255 214 328 546 314 634 202 748 108 164 816 991 22 843 147 524 735 658 63 839 720 175 847 373 506 679 199 334 907 9...
  311. Answer
  312. 283 699 619 182 607 82 537 768 961 778 996 737 409 19 565 636 149 526 734 359 133 845 622 876 124 903 430 726 389 958 302 797 323 501 433 914 391 708 398 798 733 879 488 61 138 74 38 589 579 80 523 203 921 902 752 599 627 472 646 675 479 759 205 327 452 163 113 727 559 812 151 179 438 94 76 159 218 881 469 566 442 392 450 500 289 528 895 468 423 412 856 612 115 519 928 624 723 195 918 401 132 255 214 328 546 314 634 202 748 108 164 816 991 22 843 147 524 735 658 63 839 720 175 847 373 506 679 199 334 907 9...
  313. Checker Log
  314. ok Correct ^ ^
  315. Test: #30, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  316. Input
  317. 1000
  318. 268 75 593 697 195 401 434 279 256 65 81 156 599 917 186 761 154 381 445 961 879 353 386 522 193 868 705 228 24 260 990 801 592 105 874 382 887 533 209 722 505 764 366 143 510 614 810 281 72 74 735 13 146 122 20 934 376 803 663 31 259 875 113 941 90 174 600 563 559 134 2 394 757 189 598 607 685 144 246 965 306 59 739 866 940 704 527 954 98 88 474 861 988 102 254 579 83 571 18 512 613 759 730 876 891 771 28 983 955 914 203 909 245 286 267 395 804 417 257 942 756 633 199 556 499 283 87 403 995 750 464 ...
  319. Output
  320. 268 75 593 697 195 401 434 279 256 65 81 156 599 917 186 761 154 381 445 961 879 353 386 522 193 868 705 228 24 260 990 801 592 105 874 382 887 533 209 722 505 764 366 143 510 614 810 281 72 74 735 13 146 122 20 934 376 803 663 31 259 875 113 941 90 174 600 563 559 134 2 394 757 189 598 607 685 144 246 965 306 59 739 866 940 704 527 954 98 88 474 861 988 102 254 579 83 571 18 512 613 759 730 876 891 771 28 983 955 914 203 909 245 286 267 395 804 417 257 942 756 633 199 556 499 283 87 403 995 750 464 160 89...
  321. Answer
  322. 268 75 593 697 195 401 434 279 256 65 81 156 599 917 186 761 154 381 445 961 879 353 386 522 193 868 705 228 24 260 990 801 592 105 874 382 887 533 209 722 505 764 366 143 510 614 810 281 72 74 735 13 146 122 20 934 376 803 663 31 259 875 113 941 90 174 600 563 559 134 2 394 757 189 598 607 685 144 246 965 306 59 739 866 940 704 527 954 98 88 474 861 988 102 254 579 83 571 18 512 613 759 730 876 891 771 28 983 955 914 203 909 245 286 267 395 804 417 257 942 756 633 199 556 499 283 87 403 995 750 464 160 89...
  323. Checker Log
  324. ok Correct ^ ^
  325. Test: #31, time: 0 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  326. Input
  327. 5
  328. 5 4 5 3 1
  329. 4 4 2 3 1
  330. Output
  331. 5 4 2 3 1
  332. Answer
  333. 5 4 2 3 1
  334. Checker Log
  335. ok Correct ^ ^
  336. Test: #32, time: 15 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  337. Input
  338. 5
  339. 4 1 2 4 5
  340. 3 1 2 5 5
  341. Output
  342. 3 1 2 4 5
  343. Answer
  344. 3 1 2 4 5
  345. Checker Log
  346. ok Correct ^ ^
  347. Test: #33, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  348. Input
  349. 3
  350. 2 2 3
  351. 1 3 3
  352. Output
  353. 1 2 3
  354. Answer
  355. 1 2 3
  356. Checker Log
  357. ok Correct ^ ^
  358. Test: #34, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  359. Input
  360. 3
  361. 1 1 3
  362. 2 3 3
  363. Output
  364. 2 1 3
  365. Answer
  366. 2 1 3
  367. Checker Log
  368. ok Correct ^ ^
  369. Test: #35, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  370. Input
  371. 5
  372. 5 4 5 3 1
  373. 2 4 4 3 1
  374. Output
  375. 2 4 5 3 1
  376. Answer
  377. 2 4 5 3 1
  378. Checker Log
  379. ok Correct ^ ^
  380. Test: #36, time: 15 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  381. Input
  382. 3
  383. 3 3 1
  384. 2 1 1
  385. Output
  386. 2 3 1
  387. Answer
  388. 2 3 1
  389. Checker Log
  390. ok Correct ^ ^
  391. Test: #37, time: 15 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  392. Input
  393. 5
  394. 5 4 3 5 2
  395. 5 4 1 1 2
  396. Output
  397. 5 4 3 1 2
  398. Answer
  399. 5 4 3 1 2
  400. Checker Log
  401. ok Correct ^ ^
  402. Test: #38, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  403. Input
  404. 6
  405. 1 2 3 4 2 5
  406. 1 6 3 4 4 5
  407. Output
  408. 1 6 3 4 2 5
  409. Answer
  410. 1 6 3 4 2 5
  411. Checker Log
  412. ok Correct ^ ^
  413. Test: #39, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  414. Input
  415. 4
  416. 1 3 2 1
  417. 2 3 2 1
  418. Output
  419. 4 3 2 1
  420. Answer
  421. 4 3 2 1
  422. Checker Log
  423. ok Correct ^ ^
  424. Test: #40, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  425. Input
  426. 4
  427. 1 3 3 4
  428. 1 4 3 4
  429. Output
  430. 1 2 3 4
  431. Answer
  432. 1 2 3 4
  433. Checker Log
  434. ok Correct ^ ^
  435. Test: #41, time: 0 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  436. Input
  437. 11
  438. 1 2 3 4 5 6 7 8 9 10 10
  439. 1 2 3 4 5 6 7 8 9 10 3
  440. Output
  441. 1 2 3 4 5 6 7 8 9 10 11
  442. Answer
  443. 1 2 3 4 5 6 7 8 9 10 11
  444. Checker Log
  445. ok Correct ^ ^
  446. Test: #42, time: 15 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  447. Input
  448. 5
  449. 1 2 3 2 5
  450. 1 4 3 3 5
  451. Output
  452. 1 4 3 2 5
  453. Answer
  454. 1 4 3 2 5
  455. Checker Log
  456. ok Correct ^ ^
  457. Test: #43, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  458. Input
  459. 5
  460. 1 2 3 4 3
  461. 1 2 5 4 2
  462. Output
  463. 1 2 5 4 3
  464. Answer
  465. 1 2 5 4 3
  466. Checker Log
  467. ok Correct ^ ^
  468. Test: #44, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  469. Input
  470. 5
  471. 1 2 3 4 4
  472. 1 2 3 4 3
  473. Output
  474. 1 2 3 4 5
  475. Answer
  476. 1 2 3 4 5
  477. Checker Log
  478. ok Correct ^ ^
  479. Test: #45, time: 0 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  480. Input
  481. 4
  482. 1 3 1 4
  483. 1 3 4 4
  484. Output
  485. 1 3 2 4
  486. Answer
  487. 1 3 2 4
  488. Checker Log
  489. ok Correct ^ ^
  490. Test: #46, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  491. Input
  492. 5
  493. 2 5 3 2 1
  494. 4 5 3 3 1
  495. Output
  496. 4 5 3 2 1
  497. Answer
  498. 4 5 3 2 1
  499. Checker Log
  500. ok Correct ^ ^
  501. Test: #47, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  502. Input
  503. 5
  504. 1 2 3 2 5
  505. 1 3 3 4 5
  506. Output
  507. 1 2 3 4 5
  508. Answer
  509. 1 2 3 4 5
  510. Checker Log
  511. ok Correct ^ ^
  512. Test: #48, time: 15 ms., memory: 20 KB, exit code: 0, checker exit code: 0, verdict: OK
  513. Input
  514. 5
  515. 5 2 3 4 5
  516. 2 2 3 4 5
  517. Output
  518. 1 2 3 4 5
  519. Answer
  520. 1 2 3 4 5
  521. Checker Log
  522. ok Correct ^ ^
  523. Test: #49, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  524. Input
  525. 5
  526. 5 4 1 1 2
  527. 5 4 3 5 2
  528. Output
  529. 5 4 3 1 2
  530. Answer
  531. 5 4 3 1 2
  532. Checker Log
  533. ok Correct ^ ^
  534. Test: #50, time: 0 ms., memory: 8 KB, exit code: 0, checker exit code: 0, verdict: OK
  535. Input
  536. 4
  537. 1 4 3 4
  538. 1 3 3 4
  539. Output
  540. 1 2 3 4
  541. Answer
  542. 1 2 3 4
  543. Checker Log
  544. ok Correct ^ ^
  545. Test: #51, time: 15 ms., memory: 12 KB, exit code: 0, checker exit code: 0, verdict: OK
  546. Input
  547. 4
  548. 1 2 3 1
  549. 1 2 3 2
  550. Output
  551. 1 2 3 4
  552. Answer
  553. 1 2 3 4
  554. Checker Log
  555. ok Correct ^ ^
  556. Test: #52, time: 0 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  557. Input
  558. 5
  559. 4 5 3 3 1
  560. 2 5 3 2 1
  561. Output
  562. 4 5 3 2 1
  563. Answer
  564. 4 5 3 2 1
  565. Checker Log
  566. ok Correct ^ ^
  567. Test: #53, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  568. Input
  569. 5
  570. 1 2 3 5 5
  571. 1 2 3 4 3
  572. Output
  573. 1 2 3 4 5
  574. Answer
  575. 1 2 3 4 5
  576. Checker Log
  577. ok Correct ^ ^
  578. Test: #54, time: 15 ms., memory: 16 KB, exit code: 0, checker exit code: 0, verdict: OK
  579. Input
  580. 4
  581. 2 3 3 4
  582. 2 4 3 4
  583. Output
  584. 2 1 3 4
  585. Answer
  586. 2 1 3 4
  587. Checker Log
  588. ok Correct ^ ^

发表评论

表情:
评论列表 (有 0 条评论,227人围观)

还没有评论,来说两句吧...

相关阅读

    相关 ACM.暴力

    \有一类问题可以采用一种盲目的搜索方法,在搜索结果的过程中,把各种可能的情况都考虑到,并对所得的结果逐一进行判断,过滤掉那些不符合要求的,保留那些符合要求的,这种方法叫枚举算法

    相关 暴力

    Problem Description 小埋今天出门准备买一堆漫画书回来,书的套餐类型有 3 种,第一种书是单本的,第二种书是两本捆在一起的,第三种是三本书捆在一起的。每