QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#527114#8353. T1ucup-team3763100 ✓1396ms10296kbC++172.5kb2024-08-22 10:23:482024-08-22 10:23:49

详细

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 1ms
memory: 6260kb

input:

10 10
10 9 8 7 6 5 4 3 2 1
16 19 18 17 20 15 14 13 60 11
30 52 28 27 26 25 24 23 22 21
40 39 38 37 36 35 34 33 32 31
50 49 48 47 46 45 44 43 42 41
12 59 58 57 56 55 70 53 29 51
54 69 68 67 66 65 64 63 62 61
80 79 78 77 76 75 74 92 72 71
90 89 88 87 86 85 84 83 82 81
100 99 98 97 96 95 94 93 73 91

output:

161565

result:

ok single line: '161565'

Test #2:

score: 20
Accepted
time: 1ms
memory: 6180kb

input:

10 10
77 62 56 97 96 29 48 93 92 91
90 89 63 87 86 85 39 22 5 81
80 79 78 100 76 75 27 73 72 1
70 69 68 31 66 65 64 52 99 61
60 59 58 57 98 55 54 36 53 2
50 49 94 47 46 45 44 43 8 41
40 84 38 37 28 35 34 33 14 67
30 95 82 74 26 25 24 23 83 21
20 19 18 17 16 15 32 13 12 11
10 9 42 7 6 88 4 3 51 71

output:

15613

result:

ok single line: '15613'

Test #3:

score: 20
Accepted
time: 1ms
memory: 6140kb

input:

10 10
58 96 17 38 12 60 26 7 100 88
14 23 11 67 49 15 87 59 46 81
95 33 24 27 64 78 50 29 43 5
56 34 91 42 66 31 3 35 6 4
16 9 48 22 73 47 72 8 93 80
10 77 79 39 20 28 19 40 57 69
83 76 30 85 71 45 82 13 61 55
92 94 25 54 52 21 44 68 99 1
74 97 51 37 41 65 18 36 75 84
63 53 70 32 86 90 89 2 98 62

output:

5879

result:

ok single line: '5879'

Test #4:

score: 20
Accepted
time: 1ms
memory: 5944kb

input:

10 10
100 2 50 49 48 47 76 9 8 7
67 66 65 64 63 62 61 60 59 58
57 79 78 77 46 45 44 43 42 41
40 39 38 5 6 68 69 70 71 72
73 86 85 84 83 82 81 80 56 55
54 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32 33 34
35 36 37 4 3 51 52 53 15 14
13 12 96 95 94 93 92 91 90 89
88 87 74 75 10 11 97 98 99 1

output:

19034

result:

ok single line: '19034'

Test #5:

score: 20
Accepted
time: 1ms
memory: 6052kb

input:

10 10
14 15 62 63 64 65 51 50 49 48
47 46 71 60 61 16 55 54 53 52
66 67 68 72 45 44 43 42 41 40
39 38 37 36 35 34 33 32 31 30
29 28 27 26 25 24 23 22 21 20
19 18 17 56 57 58 59 70 69 73
82 81 80 79 78 98 99 100 13 96
95 94 93 92 91 90 89 88 87 86
85 84 83 74 75 76 77 97 12 11
10 9 8 7 6 5 4 3 2 1

output:

24015

result:

ok single line: '24015'

Test #6:

score: 20
Accepted
time: 1ms
memory: 6108kb

input:

9 10
9 58 56 40 8 75 3 59 87 35
51 54 23 72 68 70 13 83 84 2
63 62 52 28 50 39 42 90 43 5
41 17 78 64 47 7 32 65 69 89
45 27 71 57 79 33 74 46 48 6
80 16 36 10 29 21 14 67 18 26
60 86 4 22 61 82 38 88 11 37
1 49 19 77 20 31 44 66 55 53
73 30 24 34 81 76 12 85 15 25

output:

4520

result:

ok single line: '4520'

Test #7:

score: 20
Accepted
time: 0ms
memory: 6044kb

input:

10 2
3 16
5 11
18 20
15 17
8 2
9 6
13 7
12 4
1 10
14 19

output:

325

result:

ok single line: '325'

Subtask #2:

score: 25
Accepted

Test #8:

score: 25
Accepted
time: 21ms
memory: 6360kb

input:

15 15
146 31 130 80 142 124 140 105 54 5 197 144 202 170 107
108 6 69 168 34 59 73 151 132 3 104 172 115 147 199
63 85 217 42 156 30 157 171 200 145 19 143 162 4 210
191 133 222 39 40 166 213 220 211 13 180 8 192 22 89
174 62 10 121 196 74 186 1 38 149 218 46 12 87 126
25 165 188 75 184 123 78 148 1...

output:

35335

result:

ok single line: '35335'

Test #9:

score: 25
Accepted
time: 24ms
memory: 6156kb

input:

15 15
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
111 112 113 114 115 116 117 110 109 108 74 75 76 77 195
132 131 130 129 128 127 126 125 124 123 122 121 120 119 118
147 146 145 144 143 142 141 140 139 138 137 136 135 134 13...

output:

4004997

result:

ok single line: '4004997'

Test #10:

score: 25
Accepted
time: 21ms
memory: 6360kb

input:

15 15
225 224 223 222 221 220 219 218 217 216 215 214 213 212 211
210 209 208 207 206 40 39 29 28 27 26 25 24 23 22
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7
6 5 4 3 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...

output:

2149077

result:

ok single line: '2149077'

Test #11:

score: 25
Accepted
time: 3ms
memory: 5936kb

input:

3 15
34 9 22 13 41 26 19 39 23 16 24 29 45 42 10
4 6 18 1 33 28 12 7 8 14 30 44 40 15 25
17 2 38 43 21 3 5 27 32 11 37 35 31 20 36

output:

2247

result:

ok single line: '2247'

Test #12:

score: 25
Accepted
time: 4ms
memory: 6316kb

input:

15 12
164 41 93 162 136 126 32 85 133 65 122 150
91 26 3 124 147 154 128 43 54 58 12 130
169 9 83 134 151 10 27 98 76 111 4 153
81 1 53 46 36 167 14 21 66 103 100 87
25 146 120 2 141 95 57 37 118 138 42 96
60 94 34 145 69 73 33 156 72 6 173 170
142 109 62 148 144 178 68 108 102 40 166 92
157 48 163 ...

output:

21159

result:

ok single line: '21159'

Test #13:

score: 25
Accepted
time: 27ms
memory: 5952kb

input:

15 15
225 224 223 222 221 99 219 165 217 216 215 214 213 212 211
210 209 208 207 206 205 204 203 202 201 200 199 198 197 196
195 194 193 192 191 190 189 188 187 186 185 184 183 182 181
180 179 178 177 176 175 174 173 172 171 170 169 168 167 166
218 164 163 162 161 160 159 158 157 156 155 154 153 152...

output:

161544769

result:

ok single line: '161544769'

Test #14:

score: 25
Accepted
time: 21ms
memory: 6328kb

input:

15 15
1 2 3 4 5 6 7 8 9 10 206 105 13 14 15
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 214 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55 145 65 58 59 60
61 62 63 64 76 66 67 152 69 70 71 72 73 74 75
148 77 78 79 80 81 82 83 84 85 142 87 88 89 90
91 92 93 94 95 96 97 175 9...

output:

4363021

result:

ok single line: '4363021'

Subtask #3:

score: 25
Accepted

Test #15:

score: 25
Accepted
time: 267ms
memory: 6092kb

input:

18 18
324 323 322 321 320 319 318 152 316 315 314 313 312 311 310 309 308 307
306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289
288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 272 271
270 269 268 267 266 265 264 263 262 261 138 259 258 58 256 255 254 253
252 251...

output:

4612987094

result:

ok single line: '4612987094'

Test #16:

score: 25
Accepted
time: 240ms
memory: 7028kb

input:

18 18
1 2 85 4 5 6 7 8 9 31 11 12 13 14 15 16 17 18
19 49 21 22 23 24 25 26 27 28 29 30 283 32 33 243 35 36
37 38 39 40 90 42 43 44 45 46 47 48 20 50 51 52 53 54
55 137 57 58 59 60 61 105 191 64 125 320 67 68 69 196 71 72
73 74 75 76 77 78 79 80 178 315 83 84 3 86 87 88 89 41
91 92 140 94 66 96 97 9...

output:

81717007

result:

ok single line: '81717007'

Test #17:

score: 25
Accepted
time: 189ms
memory: 6752kb

input:

18 18
324 321 42 106 146 83 8 104 261 223 49 47 320 204 238 201 19 43
183 284 167 307 314 244 27 4 139 323 265 319 124 263 172 322 154 210
195 13 23 249 90 301 266 107 306 159 12 100 217 78 20 60 278 80
56 245 308 202 253 163 171 133 5 97 170 280 156 52 230 155 16 68
158 302 77 115 234 276 231 281 7...

output:

88491

result:

ok single line: '88491'

Test #18:

score: 25
Accepted
time: 230ms
memory: 8132kb

input:

18 18
1 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142
141 140 139 138 137 136 135 134 133 132 131 130 129 43 44 45 46 47
48 49 50 51 52 53 54 55 56 57 58 59 23 22 21 20 19 18
17 16 15 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
309 310 311 312 313 202 203 204 20...

output:

8064835

result:

ok single line: '8064835'

Test #19:

score: 25
Accepted
time: 239ms
memory: 6880kb

input:

18 18
1 2 3 4 5 6 7 8 9 69 68 67 66 65 64 63 62 61
60 59 58 178 304 256 255 254 253 252 251 250 249 248 247 246 245 244
243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226
225 224 223 222 221 220 117 118 119 120 121 122 123 124 125 126 153 152
151 150 149 148 147 209 208 207 206 ...

output:

18417513

result:

ok single line: '18417513'

Test #20:

score: 25
Accepted
time: 21ms
memory: 3872kb

input:

1 18
9 16 1 17 5 7 6 3 13 8 2 18 10 14 4 15 12 11

output:

702

result:

ok single line: '702'

Test #21:

score: 25
Accepted
time: 1ms
memory: 6540kb

input:

18 7
30 19 33 119 66 104 117
65 114 48 8 110 25 62
7 126 71 78 64 1 35
28 55 36 29 47 54 15
44 53 42 2 52 59 11
22 3 121 18 92 102 10
105 14 120 57 31 113 51
96 124 90 118 112 109 67
106 23 41 98 82 27 56
84 49 17 13 69 60 68
16 76 99 125 97 61 86
83 5 123 4 108 93 63
103 115 40 88 79 94 6
116 46 10...

output:

12152

result:

ok single line: '12152'

Subtask #4:

score: 30
Accepted

Test #22:

score: 30
Accepted
time: 1325ms
memory: 6188kb

input:

20 20
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
361 362 363 364 365 366 367 222 369 370 371 372 373 374 375 376 377 378 379 380
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
321 322 323 324 325 326 327 328 329 330 331 332 333 33...

output:

91904600752

result:

ok single line: '91904600752'

Test #23:

score: 30
Accepted
time: 1085ms
memory: 8316kb

input:

20 20
400 399 398 397 396 395 394 393 392 391 390 389 388 387 386 385 384 383 382 381
380 379 378 377 376 375 374 373 372 371 333 369 368 367 366 365 237 363 362 361
360 359 358 357 356 355 354 86 81 351 350 103 348 347 346 345 344 343 342 341
340 339 148 337 336 335 334 370 332 331 330 329 328 327 ...

output:

1043464498

result:

ok single line: '1043464498'

Test #24:

score: 30
Accepted
time: 901ms
memory: 7424kb

input:

20 20
324 220 373 380 208 195 336 391 50 67 199 215 218 253 82 131 318 105 159 99
361 360 342 252 308 331 74 254 97 130 224 149 40 150 166 197 400 181 41 281
139 148 28 76 163 214 355 124 251 399 297 307 45 73 272 160 206 31 198 120
85 258 397 264 396 317 168 46 5 9 79 145 152 368 347 115 247 282 14...

output:

157233

result:

ok single line: '157233'

Test #25:

score: 30
Accepted
time: 1329ms
memory: 10100kb

input:

20 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 327
326 325 324 323 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307
306 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
30...

output:

191254433

result:

ok single line: '191254433'

Test #26:

score: 30
Accepted
time: 1396ms
memory: 10296kb

input:

20 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 282 283 284 285 398 397 396 395 394 393 392 391 390 389 388 387 36 35 34
33 32 369 370 371 372 373 374 375 376 377 378 379 380 381 29 28 27 26 25
24 23 22 281 280 279 278 277 276 275 274 273 272 271 270 269 268 267 266 265
264 263 262 261 2...

output:

323742533

result:

ok single line: '323742533'

Test #27:

score: 30
Accepted
time: 610ms
memory: 6848kb

input:

14 20
185 203 71 234 269 120 197 240 49 172 168 228 26 139 180 97 87 9 3 163
276 183 123 140 14 24 74 195 18 152 181 15 116 192 42 114 134 191 142 80
81 243 270 48 221 265 246 201 155 85 271 266 57 151 41 108 25 279 136 55
7 175 40 157 148 230 90 272 118 20 253 56 207 190 35 13 178 38 95 225
51 44 2...

output:

64694

result:

ok single line: '64694'

Test #28:

score: 30
Accepted
time: 1ms
memory: 8436kb

input:

20 2
6 23
10 30
37 4
39 20
33 1
32 3
16 17
22 24
11 18
21 26
8 7
25 31
9 15
34 27
38 29
40 5
36 19
12 28
13 2
14 35

output:

3614

result:

ok single line: '3614'