QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#261626#6476. Escape Roomillyakr#AC ✓19ms6472kbC++17732b2023-11-23 04:03:172023-11-23 04:03:18

Judging History

你现在查看的是最新测评结果

  • [2023-11-23 04:03:18]
  • 评测
  • 测评结果:AC
  • 用时:19ms
  • 内存:6472kb
  • [2023-11-23 04:03:17]
  • 提交

answer

#include <bits/stdc++.h>

#pragma GCC optimize("O3")
#define int long long

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n;
int a[101010];
int ans[101010];
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	vector<pair<int, int> > v;
	for (int i = 1; i <= n; i++) {
		v.push_back({a[i], i});
	}
	sort(v.begin(), v.end());
	int p = n;
	for (auto [val, pos] : v) {
		ans[pos] = p--;
	}
	for (int i = 1; i <= n; i++)
		cout << ans[i] << " ";
	cout << '\n';
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3416kb

input:

4
1 2 2 1

output:

4 2 1 3 

result:

ok single line: '4 2 1 3 '

Test #2:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

1
1

output:

1 

result:

ok single line: '1 '

Test #3:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

100
11 5 5 11 9 3 5 7 3 1 7 1 5 6 3 1 7 6 8 7 10 2 7 7 6 8 3 8 9 1 7 6 3 4 1 2 1 9 9 1 2 1 2 8 5 7 3 4 3 1 2 4 5 8 7 6 6 4 3 7 3 4 5 3 3 3 3 1 1 5 1 5 5 3 4 1 4 6 3 5 1 5 1 5 4 2 2 3 2 1 2 1 2 2 2 1 2 2 2 1

output:

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

result:

ok single line: '2 42 41 1 7 66 40 22 65 100 21... 73 84 72 71 70 83 69 68 67 82 '

Test #4:

score: 0
Accepted
time: 1ms
memory: 3392kb

input:

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

output:

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

result:

ok single line: '1 2 3 6 4 5 7 8 10 13 9 12 11 ...91 92 93 94 95 96 97 98 99 100 '

Test #5:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 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 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 

result:

ok single line: '100 99 98 97 96 95 94 93 92 91... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #6:

score: 0
Accepted
time: 19ms
memory: 6432kb

input:

100000
341 221 69 22 422 82 379 208 222 475 472 377 305 1 427 55 224 191 310 79 5 388 202 196 127 321 161 68 104 459 432 210 128 362 188 394 338 76 212 216 65 418 123 172 313 45 64 349 70 211 204 283 142 213 118 191 455 356 87 99 133 26 314 468 179 273 141 206 63 49 345 408 215 29 422 397 354 213 15...

output:

7624 27849 72105 90901 1232 67397 3951 30697 27661 1 9 4124 12217 100000 1007 77415 27233 34698 11517 68463 98230 3245 32119 33529 52309 10044 42443 72489 59747 149 830 30252 52014 5445 35429 2830 7960 69506 29814 28905 73578 1426 53603 39469 11132 81317 73942 6774 71750 30026 31667 15811 47791 2960...

result:

ok single line: '7624 27849 72105 90901 1232 67... 98663 99088 99528 99527 99526 '

Test #7:

score: 0
Accepted
time: 17ms
memory: 6428kb

input:

100000
9566 9606 9542 9611 9607 9596 9588 9608 9591 9608 9590 9582 9596 9596 9603 9598 9606 9611 9603 9606 9607 9564 9589 9603 9590 9596 9598 9603 9607 9600 9583 9605 9606 9594 9585 9568 9605 9604 9588 9609 9610 9609 9565 9604 9518 9597 9588 9600 9608 9602 9585 9599 9592 9574 9606 9601 9596 9580 958...

output:

614 28 929 2 18 170 282 8 226 7 244 362 169 168 63 135 27 1 62 26 17 639 262 61 243 167 134 60 16 105 347 40 25 192 315 575 39 51 281 5 3 4 626 50 1375 152 280 104 6 77 314 117 217 461 24 94 166 390 361 15 216 215 304 528 49 261 1184 746 151 389 93 92 418 180 493 279 225 38 527 526 59 150 278 736 38...

result:

ok single line: '614 28 929 2 18 170 282 8 226 ...99996 99997 99998 99999 100000 '

Test #8:

score: 0
Accepted
time: 13ms
memory: 6420kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951...

result:

ok single line: '100000 99999 99998 99997 99996... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #9:

score: 0
Accepted
time: 13ms
memory: 6472kb

input:

100000
3046 3047 3101 3100 3052 3092 3093 3004 3072 2980 2988 3052 2992 3084 3102 3044 3079 3063 3091 3044 3052 2882 2930 3011 3082 3098 3044 3042 2996 3068 3075 3082 3079 3091 3072 3091 3081 2998 3084 3015 2963 2976 3064 3089 3031 2979 3034 3041 2972 3096 3074 3001 3071 2936 3036 3100 3095 3067 304...

output:

1308 1263 5 12 1069 76 59 3289 475 4489 4084 1068 3911 192 1 1407 306 720 91 1406 1067 9683 7018 2996 240 25 1405 1494 3700 569 399 239 305 90 474 89 259 3601 191 2806 5298 4670 689 114 2002 4536 1831 1531 4866 34 425 3439 492 6696 1740 11 44 596 1262 473 282 950 749 11182 810 113 472 157 112 190 23...

result:

ok single line: '1308 1263 5 12 1069 76 59 3289...99996 99997 99998 99999 100000 '

Test #10:

score: 0
Accepted
time: 12ms
memory: 6404kb

input:

100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951...

result:

ok single line: '100000 99999 99998 99997 99996... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #11:

score: 0
Accepted
time: 9ms
memory: 4688kb

input:

47477
4521 4466 4506 4521 4518 4519 4519 4504 4515 4507 4516 4519 4513 4506 4470 4489 4508 4487 4519 4458 4473 4503 4512 4503 4515 4518 4492 4520 4516 4450 4503 4500 4519 4501 4497 4520 4518 4506 4483 4517 4492 4506 4509 4494 4518 4491 4516 4504 4520 4515 4505 4467 4479 4443 4467 4493 4515 4517 4519...

output:

2 756 112 1 19 11 10 133 40 104 29 9 52 111 697 354 95 390 8 902 647 144 59 143 39 18 303 5 28 1049 142 176 7 166 218 4 17 110 468 24 302 109 84 271 16 327 27 132 3 38 123 739 530 1165 738 286 37 23 6 58 57 51 122 227 65 15 36 75 35 253 155 14 103 154 13 50 22 860 46 108 94 26 83 64 82 102 93 34 21 ...

result:

ok single line: '2 756 112 1 19 11 10 133 40 10... 47473 47474 47475 47476 47477 '

Test #12:

score: 0
Accepted
time: 3ms
memory: 4700kb

input:

47477
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

47477 47476 47475 47474 47473 47472 47471 47470 47469 47468 47467 47466 47465 47464 47463 47462 47461 47460 47459 47458 47457 47456 47455 47454 47453 47452 47451 47450 47449 47448 47447 47446 47445 47444 47443 47442 47441 47440 47439 47438 47437 47436 47435 47434 47433 47432 47431 47430 47429 47428 ...

result:

ok single line: '47477 47476 47475 47474 47473 ... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #13:

score: 0
Accepted
time: 3ms
memory: 5824kb

input:

79832
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

79832 79831 79830 79829 79828 79827 79826 79825 79824 79823 79822 79821 79820 79819 79818 79817 79816 79815 79814 79813 79812 79811 79810 79809 79808 79807 79806 79805 79804 79803 79802 79801 79800 79799 79798 79797 79796 79795 79794 79793 79792 79791 79790 79789 79788 79787 79786 79785 79784 79783 ...

result:

ok single line: '79832 79831 79830 79829 79828 ... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #14:

score: 0
Accepted
time: 8ms
memory: 5076kb

input:

63256
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

63256 63255 63254 63253 63252 63251 63250 63249 63248 63247 63246 63245 63244 63243 63242 63241 63240 63239 63238 63237 63236 63235 63234 63233 63232 63231 63230 63229 63228 63227 63226 63225 63224 63223 63222 63221 63220 63219 63218 63217 63216 63215 63214 63213 63212 63211 63210 63209 63208 63207 ...

result:

ok single line: '63256 63255 63254 63253 63252 ... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #15:

score: 0
Accepted
time: 6ms
memory: 4704kb

input:

46680
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

46680 46679 46678 46677 46676 46675 46674 46673 46672 46671 46670 46669 46668 46667 46666 46665 46664 46663 46662 46661 46660 46659 46658 46657 46656 46655 46654 46653 46652 46651 46650 46649 46648 46647 46646 46645 46644 46643 46642 46641 46640 46639 46638 46637 46636 46635 46634 46633 46632 46631 ...

result:

ok single line: '46680 46679 46678 46677 46676 ... 13 12 11 10 9 8 7 6 5 4 3 2 1 '

Test #16:

score: 0
Accepted
time: 8ms
memory: 5088kb

input:

62808
62808 62807 62806 62805 62804 62803 62802 62801 62800 62799 62798 62797 62796 62795 62794 62793 62792 62791 62790 62789 62788 62787 62786 62785 62784 62783 62782 62781 62780 62779 62778 62777 62776 62775 62774 62773 62772 62771 62770 62769 62768 62767 62766 62765 62764 62763 62762 62761 62760 ...

output:

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 ...

result:

ok single line: '1 2 3 4 5 6 7 8 9 10 11 12 13 ... 62804 62805 62806 62807 62808 '

Test #17:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

2
2 1

output:

1 2 

result:

ok single line: '1 2 '