QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#773716 | #9792. Ogre Sort | ucup-team5319# | RE | 13ms | 5020kb | C++14 | 607b | 2024-11-23 10:02:42 | 2024-11-23 10:02:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int a[MAXN], b[MAXN]; bool tag[MAXN];
int c[MAXN];
void modify(int u) {for (; u < MAXN; u += u & -u) c[u]++;}
int query(int u) {int w = 0; for (; u; u -= u & -u) w += c[u]; return w;}
int main() {
int n; scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
for (int i = 1; i <= n; i++) b[a[i]] = i;
int p = n; while (p > 1 && b[p - 1] < b[p]) p--;
printf("%d %d\n", p - 1, p - 1);
for (int i = p - 1; i; i--) {
int x = b[i] + (p - 1 - i - query(b[i])); modify(b[i]);
printf("%d %d\n", x, 1);
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3948kb
input:
4 1 2 4 3
output:
3 3 4 1 3 1 3 1
result:
ok Participant's output is correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
5 2 4 1 3 5
output:
3 3 4 1 2 1 4 1
result:
ok Participant's output is correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
3 1 2 3
output:
0 0
result:
ok Participant's output is correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
4 1 2 4 3
output:
3 3 4 1 3 1 3 1
result:
ok Participant's output is correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
5 2 4 1 3 5
output:
3 3 4 1 2 1 4 1
result:
ok Participant's output is correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
3 1 2 3
output:
0 0
result:
ok Participant's output is correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
1 1
output:
0 0
result:
ok Participant's output is correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
5 5 3 4 1 2
output:
4 4 3 1 3 1 5 1 5 1
result:
ok Participant's output is correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
5 4 1 2 3 5
output:
3 3 4 1 4 1 4 1
result:
ok Participant's output is correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
5 1 3 4 2 5
output:
2 2 4 1 2 1
result:
ok Participant's output is correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
5 1 4 5 2 3
output:
3 3 5 1 5 1 3 1
result:
ok Participant's output is correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
5 1 5 4 3 2
output:
4 4 3 1 4 1 5 1 4 1
result:
ok Participant's output is correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
5 3 2 1 5 4
output:
4 4 5 1 2 1 3 1 4 1
result:
ok Participant's output is correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
5 2 5 3 1 4
output:
4 4 5 1 4 1 3 1 5 1
result:
ok Participant's output is correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
5 2 1 4 5 3
output:
3 3 5 1 2 1 3 1
result:
ok Participant's output is correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
5 5 3 2 1 4
output:
4 4 5 1 3 1 4 1 5 1
result:
ok Participant's output is correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5 5 3 1 4 2
output:
4 4 4 1 3 1 5 1 5 1
result:
ok Participant's output is correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
5 3 1 5 4 2
output:
4 4 4 1 2 1 5 1 4 1
result:
ok Participant's output is correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
5 1 4 5 3 2
output:
3 3 4 1 5 1 3 1
result:
ok Participant's output is correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
5 1 4 3 2 5
output:
3 3 3 1 4 1 3 1
result:
ok Participant's output is correct
Test #21:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
5 1 4 3 5 2
output:
3 3 3 1 5 1 3 1
result:
ok Participant's output is correct
Test #22:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
5 3 5 4 2 1
output:
4 4 3 1 2 1 4 1 5 1
result:
ok Participant's output is correct
Test #23:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
5 1 5 4 2 3
output:
4 4 3 1 5 1 5 1 4 1
result:
ok Participant's output is correct
Test #24:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
5 2 4 5 3 1
output:
3 3 4 1 2 1 5 1
result:
ok Participant's output is correct
Test #25:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
5 1 3 2 4 5
output:
2 2 3 1 2 1
result:
ok Participant's output is correct
Test #26:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
5 1 5 3 2 4
output:
4 4 5 1 4 1 5 1 4 1
result:
ok Participant's output is correct
Test #27:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
5 2 1 3 5 4
output:
4 4 5 1 4 1 3 1 4 1
result:
ok Participant's output is correct
Test #28:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
5 1 3 5 2 4
output:
4 4 5 1 3 1 5 1 4 1
result:
ok Participant's output is correct
Test #29:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
5 5 1 4 2 3
output:
4 4 3 1 5 1 5 1 5 1
result:
ok Participant's output is correct
Test #30:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
5 2 5 3 4 1
output:
4 4 4 1 4 1 3 1 5 1
result:
ok Participant's output is correct
Test #31:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
5 3 4 1 2 5
output:
2 2 4 1 4 1
result:
ok Participant's output is correct
Test #32:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
20 11 2 3 1 6 12 13 5 14 4 8 15 16 7 17 9 10 18 19 20
output:
10 10 17 1 17 1 13 1 16 1 9 1 12 1 14 1 10 1 10 1 11 1
result:
ok Participant's output is correct
Test #33:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
20 4 3 1 6 7 5 8 9 10 11 2 12 13 14 15 16 17 18 19 20
output:
5 5 6 1 2 1 3 1 11 1 5 1
result:
ok Participant's output is correct
Test #34:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
200 4 61 13 19 62 63 10 3 2 23 64 65 66 49 15 34 67 68 69 70 71 24 72 30 7 73 74 75 20 76 77 78 37 79 47 80 81 82 33 31 57 51 83 60 28 84 36 85 54 53 86 87 42 41 40 9 50 59 88 89 90 56 91 45 92 58 93 94 95 96 16 97 98 29 99 100 44 101 8 27 102 103 32 104 105 25 21 17 52 106 11 107 6 22 38 108 109 14...
output:
60 60 44 1 58 1 66 1 44 1 63 1 106 1 53 1 54 1 90 1 50 1 62 1 25 1 112 1 47 1 107 1 69 1 81 1 106 1 64 1 65 1 66 1 108 1 100 1 55 1 65 1 112 1 41 1 62 1 91 1 64 1 52 1 84 1 67 1 89 1 113 1 95 1 56 1 47 1 102 1 97 1 64 1 45 1 130 1 99 1 89 1 57 1 106 1 50 1 126 1 103 1 55 1 83 1 98 1 69 1 105 1 112 1...
result:
ok Participant's output is correct
Test #35:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
200 24 25 11 5 4 12 9 26 27 7 28 29 3 30 14 17 15 20 18 31 6 32 33 22 8 34 35 21 16 19 36 37 2 10 38 23 39 13 40 41 1 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 ...
output:
23 23 36 1 25 1 29 1 21 1 31 1 23 1 22 1 31 1 24 1 24 1 38 1 17 1 15 1 36 1 19 1 31 1 23 1 29 1 21 1 22 1 27 1 36 1 41 1
result:
ok Participant's output is correct
Test #36:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
2000 1741 1583 1742 244 90 1743 1744 1745 1428 1746 1747 50 1537 1748 749 1749 1067 622 1750 1751 1752 1753 1754 1755 1547 1756 1757 1663 1758 403 1759 1760 1761 1762 1677 1763 1764 1030 1280 1765 1717 939 1766 711 1767 1768 1769 1770 1055 1771 1772 1061 1773 1214 1716 1774 1775 1144 1776 1777 1778 ...
output:
1740 1740 1926 1 1053 1 935 1 1743 1 1429 1 1802 1 770 1 1039 1 559 1 1745 1 1576 1 1875 1 582 1 1308 1 1439 1 1158 1 1558 1 1933 1 1412 1 1373 1 1932 1 1177 1 1406 1 64 1 78 1 1887 1 1258 1 1922 1 1095 1 541 1 1288 1 1789 1 561 1 1462 1 1531 1 1421 1 1469 1 1192 1 742 1 1027 1 860 1 139 1 1620 1 18...
result:
ok Participant's output is correct
Test #37:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
2000 985 926 580 986 645 623 987 988 816 989 990 991 50 992 437 993 541 994 800 995 996 997 998 28 999 34 110 57 611 1000 724 97 662 1001 1002 1003 351 1004 280 1005 1006 936 181 148 1007 109 1008 549 1009 1010 714 1011 1012 1013 1014 192 1015 67 1016 783 1017 1018 1019 944 402 722 1020 1021 903 671...
output:
984 984 1390 1 325 1 1391 1 890 1 1117 1 922 1 407 1 523 1 169 1 1662 1 1503 1 1475 1 555 1 1473 1 512 1 106 1 1521 1 825 1 1421 1 930 1 368 1 1366 1 438 1 1086 1 1859 1 1825 1 623 1 1396 1 1677 1 537 1 1759 1 1101 1 1096 1 943 1 1068 1 970 1 1070 1 205 1 1244 1 1516 1 104 1 766 1 1473 1 1627 1 760 ...
result:
ok Participant's output is correct
Test #38:
score: 0
Accepted
time: 0ms
memory: 4204kb
input:
19934 19839 19840 13621 19841 271 19842 4329 19843 19844 17253 8288 19845 5182 19846 11341 8790 7371 19847 19848 19849 19850 17841 3277 19851 19852 19853 19854 19855 17960 19856 10580 19857 730 7813 19858 371 11760 19859 19860 17938 19861 4585 19862 12350 19863 15426 19864 19865 19866 14628 11864 19...
output:
19838 19838 18815 1 1612 1 628 1 17941 1 11483 1 1243 1 2174 1 15019 1 14382 1 3175 1 3235 1 16224 1 12739 1 15661 1 18995 1 3263 1 17294 1 7080 1 17541 1 15441 1 18562 1 12590 1 8521 1 3259 1 9403 1 13419 1 7907 1 1060 1 13293 1 12707 1 7663 1 13747 1 3043 1 4250 1 5141 1 4083 1 19277 1 18705 1 863...
result:
ok Participant's output is correct
Test #39:
score: 0
Accepted
time: 3ms
memory: 4108kb
input:
19934 5219 14820 14821 14822 14823 14824 14825 3510 14826 14827 14828 2256 4166 14829 14830 14788 8570 5618 14831 14832 13392 14833 10688 4209 14834 14835 12575 14836 8996 12088 7132 2554 14837 14220 14838 11060 796 14839 5982 14840 1775 14841 3247 14842 12204 14843 9493 8928 6087 14844 1831 12138 1...
output:
14819 14819 4260 1 10037 1 17234 1 8096 1 17680 1 5550 1 14954 1 14388 1 8800 1 12455 1 13926 1 159 1 10932 1 1982 1 5217 1 12410 1 11199 1 6911 1 1875 1 5987 1 15954 1 13912 1 18716 1 17168 1 10729 1 12456 1 7180 1 17378 1 16446 1 5384 1 268 1 47 1 14767 1 11268 1 5006 1 13611 1 11749 1 12929 1 388...
result:
ok Participant's output is correct
Test #40:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
5 4 5 2 1 3
output:
3 3 5 1 4 1 5 1
result:
ok Participant's output is correct
Test #41:
score: 0
Accepted
time: 12ms
memory: 5020kb
input:
90000 65253 42375 65254 38419 27902 4421 65255 65256 43571 8888 65257 65258 65259 56046 48333 65260 41674 28086 17472 60606 57320 45775 30789 65261 65262 65263 65264 65265 58837 65266 6340 65267 65268 65269 49935 65270 65271 2758 24781 53306 26100 65272 65273 56411 65274 65275 54501 53036 53922 3988...
output:
65252 65252 13516 1 71108 1 50440 1 63443 1 83978 1 76458 1 51049 1 89621 1 5400 1 42637 1 62885 1 30583 1 61008 1 65613 1 87233 1 63561 1 34560 1 2543 1 57988 1 30926 1 4410 1 77213 1 61436 1 68136 1 21611 1 84326 1 73519 1 67602 1 76200 1 71501 1 37944 1 88462 1 70398 1 28275 1 58407 1 87008 1 558...
result:
ok Participant's output is correct
Test #42:
score: 0
Accepted
time: 9ms
memory: 4864kb
input:
90000 37606 23908 37607 37608 37609 37610 37611 37612 22598 26934 37613 37614 37615 37616 37617 29075 13478 37618 37619 1166 36156 37620 32850 37621 37622 7850 37623 37624 37625 12081 37626 3175 7251 37627 37628 30885 37629 37630 11499 12609 37631 37632 37633 7290 8683 37634 2556 9462 31810 37635 25...
output:
37605 37605 27337 1 5116 1 34502 1 71924 1 17926 1 32585 1 42104 1 11285 1 5698 1 52592 1 48273 1 75227 1 46690 1 56249 1 27275 1 9508 1 10830 1 3730 1 2949 1 48521 1 19414 1 31630 1 56489 1 21468 1 69656 1 12463 1 74256 1 12882 1 22135 1 7008 1 66990 1 23130 1 40020 1 45164 1 16271 1 13437 1 48148 ...
result:
ok Participant's output is correct
Test #43:
score: 0
Accepted
time: 8ms
memory: 4904kb
input:
90000 30352 30353 30354 5359 30355 30356 30357 21495 30358 30359 8376 3685 30360 30361 6986 30362 30363 1408 16857 2885 30364 371 2129 30365 30366 30367 30368 30369 30370 30371 21284 1705 28049 30372 30373 26108 30374 27360 30375 30376 30377 27430 30378 30379 937 3222 30380 30381 20250 30382 30383 1...
output:
30351 30351 47771 1 46880 1 25262 1 9827 1 12719 1 60232 1 29315 1 7495 1 28936 1 23410 1 6549 1 17010 1 4531 1 57171 1 55198 1 56217 1 49389 1 52218 1 31966 1 37203 1 19968 1 10880 1 11092 1 26777 1 47697 1 286 1 7410 1 47855 1 6801 1 44061 1 20694 1 39585 1 33204 1 14015 1 35023 1 29678 1 10429 1 ...
result:
ok Participant's output is correct
Test #44:
score: 0
Accepted
time: 12ms
memory: 4956kb
input:
90000 69939 33081 12859 28541 69940 62264 34253 69941 56583 24512 8206 9404 69942 69943 8807 69944 69945 5450 22638 47330 2724 69946 69947 69948 16754 69949 69950 63766 832 69951 18992 11116 69952 13043 37048 69953 69954 69955 56888 69956 39134 41836 69957 69958 61990 69959 68275 60927 57169 40220 3...
output:
69938 69938 12453 1 36488 1 46566 1 54139 1 48596 1 33101 1 8568 1 75592 1 21407 1 60055 1 55586 1 57873 1 80952 1 17507 1 36058 1 4889 1 74338 1 15640 1 87443 1 50149 1 74381 1 73982 1 61235 1 32767 1 73577 1 56461 1 55615 1 64865 1 7420 1 62163 1 72752 1 76183 1 18634 1 38189 1 67495 1 22095 1 766...
result:
ok Participant's output is correct
Test #45:
score: 0
Accepted
time: 7ms
memory: 4972kb
input:
90000 52532 26054 52533 49100 52534 50092 14993 2099 52535 52536 52537 35999 16468 52538 20324 52539 52540 3567 52541 52542 52543 49955 36545 52544 52545 52546 52547 52548 52549 52550 52551 51135 52552 52553 52554 52555 52526 33987 52556 52557 42496 33364 11053 52558 52559 17011 4032 31055 52560 525...
output:
52531 52531 60985 1 89267 1 88753 1 79234 1 83886 1 42 1 62032 1 73428 1 13593 1 32478 1 31562 1 5231 1 85417 1 79434 1 63434 1 78478 1 9166 1 855 1 25377 1 15901 1 27935 1 54458 1 67481 1 79456 1 58034 1 26460 1 60208 1 36272 1 88866 1 47774 1 35034 1 7061 1 10370 1 52194 1 72569 1 21933 1 81777 1 ...
result:
ok Participant's output is correct
Test #46:
score: 0
Accepted
time: 10ms
memory: 4868kb
input:
90000 8669 39435 42259 42260 36379 42261 27504 42262 42263 42264 42265 7272 42266 42267 42268 1540 23912 22467 35273 2655 42097 11673 12726 42269 42270 23612 21178 42271 42272 25205 23369 42273 10081 42274 41053 42275 28416 18676 9062 18576 42276 42277 14261 42278 40941 42279 42280 37570 9018 17900 ...
output:
42258 42258 62902 1 1811 1 77408 1 49602 1 84483 1 65881 1 175 1 65537 1 4768 1 4609 1 19367 1 21713 1 36226 1 35926 1 32999 1 47264 1 82171 1 32104 1 24424 1 69900 1 7735 1 50642 1 33503 1 60296 1 57736 1 82618 1 8963 1 19477 1 34001 1 20189 1 41497 1 10142 1 76965 1 1465 1 13573 1 22733 1 64705 1 ...
result:
ok Participant's output is correct
Test #47:
score: 0
Accepted
time: 9ms
memory: 4936kb
input:
90000 32228 38951 38952 6510 38953 6324 38954 38955 24341 33813 7413 33906 19435 6255 15679 38956 24229 31100 38957 37502 38958 38959 38960 38961 38962 38963 38964 38965 38966 38967 38968 14147 38969 38970 38971 38972 38973 14283 38974 7448 9435 38975 38976 25487 14487 38977 38978 38979 38980 38981 ...
output:
38950 38950 15784 1 54565 1 34097 1 3173 1 65206 1 8689 1 9277 1 18463 1 7327 1 53722 1 12257 1 5694 1 38401 1 43553 1 9781 1 6029 1 67428 1 47688 1 25644 1 3844 1 7477 1 47468 1 32725 1 32934 1 28869 1 38731 1 69053 1 74756 1 3597 1 32371 1 4571 1 31598 1 12820 1 75141 1 14667 1 71781 1 7293 1 2602...
result:
ok Participant's output is correct
Test #48:
score: 0
Accepted
time: 13ms
memory: 4964kb
input:
90000 72788 35185 71961 1147 25353 61632 60994 72789 72790 72791 72792 68258 72793 72794 34346 72795 72796 72797 72798 72799 72800 72801 72802 72803 63521 72804 72805 72806 45983 10128 72807 71312 72808 72809 14136 4052 47706 27036 70918 43144 72810 72811 3398 72812 72813 72814 72815 72816 72817 316...
output:
72787 72787 70556 1 85744 1 84343 1 68519 1 12759 1 10722 1 85747 1 59805 1 46833 1 60623 1 70942 1 49626 1 28707 1 66510 1 74210 1 38645 1 22652 1 47681 1 45801 1 50302 1 25382 1 59378 1 75721 1 51452 1 35281 1 26939 1 79579 1 72783 1 81372 1 88460 1 49861 1 50121 1 29260 1 47547 1 35691 1 60504 1 ...
result:
ok Participant's output is correct
Test #49:
score: 0
Accepted
time: 8ms
memory: 4820kb
input:
90000 290 26982 3576 7822 26983 26160 19280 17853 21859 26984 26959 9437 26985 26920 26986 26987 26988 26989 5326 16746 26990 8639 10124 26991 26992 26993 26994 9061 26995 26996 26997 25238 14807 16079 26998 11347 18735 11635 6143 16086 3165 15745 26999 27000 5782 3278 27001 27002 27003 1281 17475 2...
output:
26981 26981 5766 1 6786 1 52916 1 43890 1 52770 1 9613 1 7000 1 14106 1 32407 1 13100 1 1004 1 43233 1 11578 1 36650 1 31015 1 17877 1 45470 1 17232 1 19746 1 19430 1 40990 1 47099 1 33 1 16142 1 42214 1 10565 1 24773 1 20510 1 26572 1 51897 1 53513 1 6083 1 32451 1 42681 1 38066 1 6818 1 12580 1 42...
result:
ok Participant's output is correct
Test #50:
score: 0
Accepted
time: 9ms
memory: 4924kb
input:
90000 36989 12319 3925 36990 27685 29765 28022 36991 9027 36625 36992 36993 36994 18226 36995 36869 36996 32214 4966 36997 36998 35514 36999 37000 37001 14349 37002 37003 15529 10833 37004 37005 37006 22399 35728 37007 29481 19083 18591 26775 34438 14116 37008 37009 37 37010 28548 12645 37011 37012 ...
output:
36988 36988 38378 1 58405 1 14816 1 66448 1 55726 1 1926 1 52675 1 67937 1 6348 1 3119 1 18168 1 12254 1 61701 1 40458 1 15030 1 50679 1 35574 1 4883 1 45589 1 55469 1 35026 1 74022 1 19495 1 50719 1 40920 1 56789 1 700 1 53119 1 25555 1 20985 1 28049 1 7863 1 8146 1 28733 1 3564 1 23347 1 17942 1 5...
result:
ok Participant's output is correct
Test #51:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
5 4 3 1 5 2
output:
3 3 2 1 5 1 4 1
result:
ok Participant's output is correct
Test #52:
score: -100
Runtime Error
input:
153792 64707 57538 2132 51397 64708 26410 32827 39549 33521 55673 3043 64709 24678 64710 64711 64712 64713 16632 40029 64714 64715 64716 29504 63751 64717 64718 64719 64720 50714 64721 64722 64723 64724 57772 35755 64725 34169 4856 60762 53582 18696 64726 64727 64728 64729 38848 29805 16423 3063 303...