QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#319009 | #8158. 刷野 II | Yuics | 100 ✓ | 574ms | 42932kb | C++20 | 584b | 2024-02-01 15:12:29 | 2024-02-01 15:12:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 5e6 + 7;
int d, n;
int a[N], ans[N];
int main() {
scanf("%d %d", &d, &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
int l = 1, r = n;
while (l <= r) {
int dl = max(a[l], ans[0] + 1);
int dr = max(a[r], ans[0] + 1);
if (dl >= dr) {
ans[0] = dr;
ans[n - r + l] = r;
r--;
} else {
ans[0] = dl;
ans[n - r + l] = l;
l++;
}
}
printf("%d\n", ans[0]);
for (int i = n; i >= 1; i--)
printf("%d ", ans[i]);
printf("\n");
return 0;
}
详细
Test #1:
score: 10
Accepted
time: 1ms
memory: 5796kb
input:
1 10 5 9 1 5 1 4 9 2 6 4
output:
14 2 3 4 5 6 7 8 9 1 10
result:
ok x=14
Test #2:
score: 10
Accepted
time: 1ms
memory: 5828kb
input:
2 20 4 20 2 8 16 17 8 20 15 14 3 15 19 2 9 10 4 8 20 19
output:
37 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1
result:
ok x=37
Test #3:
score: 10
Accepted
time: 1ms
memory: 5832kb
input:
3 500 326 300 132 50 404 133 98 252 483 107 157 81 425 175 291 415 383 271 341 419 89 417 84 68 10 216 497 217 89 477 53 394 353 159 398 462 174 391 212 412 6 377 348 253 253 225 288 448 82 304 81 491 224 16 320 475 109 415 298 276 318 189 428 298 349 269 84 73 233 324 322 54 266 197 383 200 62 2 31...
output:
958 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...
result:
ok x=958
Test #4:
score: 10
Accepted
time: 0ms
memory: 5856kb
input:
4 5000 3196 2167 3085 1136 1043 3012 2853 3577 3734 2235 4640 2984 4655 1593 4129 3642 3797 1156 1642 3385 3563 1760 3328 907 151 1398 2507 3073 2492 920 528 2057 4376 879 1198 205 2919 2285 3244 2378 3414 1803 3882 4914 3344 4468 2715 2410 3749 3744 793 2876 3038 3082 3073 3575 2131 2659 4571 2178 ...
output:
9869 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 156 157 158 159 160 ...
result:
ok x=9869
Test #5:
score: 10
Accepted
time: 3ms
memory: 6092kb
input:
5 50000 32317 40462 2286 2914 32868 9769 29248 17580 35780 9906 8732 1889 18123 40612 48036 15966 315 4239 21451 22053 12442 12900 21082 1753 35490 14732 9053 2965 35746 43074 32404 470 7723 21764 34547 40284 34355 6230 48754 10270 34837 25502 31405 24611 32848 30825 8420 41865 28964 20853 35069 897...
output:
99267 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 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 29...
result:
ok x=99267
Test #6:
score: 10
Accepted
time: 54ms
memory: 9920kb
input:
6 500000 432538 33441 138436 218250 139806 50435 399010 455967 11899 102440 118587 330635 445868 462994 97124 158840 355709 137689 137988 455657 469328 83174 433558 394385 92604 337017 112427 363097 448329 290181 251494 153471 4693 1038 340222 423698 387154 434194 96415 431383 165349 135965 438345 2...
output:
998907 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 4...
result:
ok x=998907
Test #7:
score: 10
Accepted
time: 59ms
memory: 8428kb
input:
7 500000 446253558 412117870 446253560 446253563 390044956 446253570 446253572 446253575 446253579 446253580 446253581 446253582 446253585 446253591 446253592 446253593 446253594 446253595 446253596 446253600 446253603 446253607 446253614 446253615 446253616 446253618 446253624 433995643 446253627 4...
output:
446753557 250006 250007 250005 250004 250003 250008 250009 250002 250001 250010 250000 249999 250011 250012 249998 249997 250013 250014 250015 249996 249995 250016 250017 249994 250018 250019 250020 250021 249993 249992 249991 250022 249990 249989 249988 249987 250023 250024 250025 249986 249985 250...
result:
ok x=446753557
Test #8:
score: 10
Accepted
time: 549ms
memory: 42904kb
input:
8 5000000 1963696 3556535 2578665 1418244 4444600 4495856 3149792 4718613 560143 985208 3380208 3515647 2269308 2410848 248087 1477275 4094873 1022633 785322 4730357 45970 1892427 2744847 1716687 3064873 1893167 651204 4798108 4954420 4211829 2912214 4369221 366813 3166447 2489515 4567271 2446689 18...
output:
9992518 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 21...
result:
ok x=9992518
Test #9:
score: 10
Accepted
time: 546ms
memory: 42912kb
input:
9 5000000 18496634 18496635 18031853 18496638 18496640 18496641 18496645 18496646 18496649 16733259 18496651 18496652 18496654 18496655 18496656 18496659 18496664 18496670 18496675 18255731 18496679 18371321 18496681 17138909 18496685 18496686 18496688 18496692 18496693 18496694 18496698 17849500 18...
output:
23496633 2499987 2499986 2499985 2499984 2499983 2499988 2499989 2499982 2499990 2499981 2499980 2499979 2499978 2499977 2499976 2499991 2499992 2499993 2499994 2499975 2499995 2499996 2499997 2499998 2499974 2499999 2499973 2499972 2499971 2499970 2499969 2499968 2499967 2500000 2500001 2500002 250...
result:
ok x=23496633
Test #10:
score: 10
Accepted
time: 574ms
memory: 42932kb
input:
10 5000000 488905867 488905868 488905869 488905871 488905873 488905874 488905876 488905877 488905878 488905883 488905885 488905886 488905888 488905889 488905890 488905894 488905895 488905896 488905897 488905898 488905899 488905900 488905901 488905903 488905905 488905906 488905907 488905908 488905910...
output:
493905865 2499959 2499958 2499957 2499956 2499960 2499955 2499961 2499954 2499953 2499952 2499962 2499951 2499950 2499963 2499964 2499965 2499966 2499967 2499968 2499969 2499949 2499948 2499947 2499946 2499970 2499945 2499971 2499944 2499943 2499972 2499973 2499942 2499941 2499974 2499940 2499975 24...
result:
ok x=493905865