UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#207600#3742. 排排序wyz_100657ms3548kbC++11521b2024-07-29 16:53:292024-07-29 17:06:45

answer

#include<bits/stdc++.h>
using namespace std;

int n,m,a[200005],b[200005];
int f[200005];

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> a[i], b[i] = a[i];
	while(m--){
		int x,y;
		cin >> x >> y;
		
		if(a[x] < a[y])
			f[y]++;
		else if(a[x] > a[y])
			f[x]++;
	}
	
	sort(b+1,b+n+1);
	
	for(int i = 1; i <= n; i++){
		int it = lower_bound(b+1,b+n+1,a[i]) - b - 1;
		
		cout << it - f[i] << ' ';
	}
	
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1272kb

input:

68 87
672247318 508774772 290746326 176428976 476886942 917833152 777797902 785151058 467283207 7739...

output:

45 35 21 11 33 61 52 53 33 51 20 17 4 39 43 25 26 40 12 37 62 0 28 53 64 10 22 19 45 43 36 1 30 53 6...

result:

ok 68 numbers

Test #2:

score: 10
Accepted
time: 0ms
memory: 1272kb

input:

53 70
59415795 789388430 66644621 639264350 492235826 838262724 429290911 468756919 688924005 793327...

output:

3 40 3 28 23 43 20 21 31 39 50 9 32 24 30 1 44 26 17 48 29 47 35 17 44 48 36 12 47 7 22 21 5 38 9 2 ...

result:

ok 53 numbers

Test #3:

score: 10
Accepted
time: 100ms
memory: 2644kb

input:

174111 1
279813522 906313758 857856003 210034707 11448887 481103816 592484284 431951955 436135357 40...

output:

48974 157928 149500 36936 2053 84191 103697 75671 76394 71360 79089 67154 35827 85894 1556 3479 4047...

result:

ok 174111 numbers

Test #4:

score: 10
Accepted
time: 78ms
memory: 2484kb

input:

152911 1
702306111 404797947 717879124 601798916 140665800 940013176 122317960 540228104 840512228 1...

output:

107364 61941 109757 91889 21525 143800 18665 82493 128706 18508 27581 122845 10939 148353 150037 104...

result:

ok 152911 numbers

Test #5:

score: 10
Accepted
time: 79ms
memory: 2620kb

input:

140495 83
66605606 834848402 683426896 920210623 485320690 968755640 86073240 87086888 347495502 130...

output:

9421 117400 96232 129361 68254 136148 12158 12305 49045 18400 68045 68009 136292 18861 114232 3336 1...

result:

ok 140495 numbers

Test #6:

score: 10
Accepted
time: 67ms
memory: 2324kb

input:

112168 52
407475517 329684865 911044403 234279461 538316933 972347344 476635176 36005246 246434866 9...

output:

45978 37211 102319 26403 60561 109080 53715 4070 27767 108716 43478 63436 25682 41964 78802 58083 58...

result:

ok 112168 numbers

Test #7:

score: 10
Accepted
time: 88ms
memory: 2720kb

input:

152826 77
123622344 428145246 910612231 219277869 261355649 859120370 883327925 985917667 906182455 ...

output:

18979 65460 139198 33465 39988 131439 135118 150625 138520 41555 104479 45048 41065 80283 7637 8833 ...

result:

ok 152826 numbers

Test #8:

score: 10
Accepted
time: 108ms
memory: 3548kb

input:

193435 192486
270221619 837207913 153334187 60454282 677657649 608643506 233776256 137272392 8118486...

output:

51859 161827 29358 11595 130892 117496 44883 26330 156940 45696 180135 20043 7713 54395 25003 191373...

result:

ok 193435 numbers

Test #9:

score: 10
Accepted
time: 68ms
memory: 2492kb

input:

103040 194775
24304967 522487456 523147399 346252957 473225628 737528188 388059441 73215599 83832834...

output:

2519 53732 53806 35627 48631 75844 39890 7447 86319 10401 84403 84538 54042 46673 92229 62376 4233 4...

result:

ok 103040 numbers

Test #10:

score: 10
Accepted
time: 69ms
memory: 2836kb

input:

132794 133327
827618495 201784982 335022182 339430727 402586090 79494916 665376077 351042609 2477541...

output:

109921 26950 44481 45025 53434 10739 88261 46546 33031 61848 58099 75643 44452 80388 62497 49357 824...

result:

ok 132794 numbers