QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#594549#5481. Beast BulliesandaheAC ✓63ms7548kbC++17410b2024-09-28 06:10:382024-09-28 06:10:40

Judging History

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

  • [2024-09-28 06:10:40]
  • 评测
  • 测评结果:AC
  • 用时:63ms
  • 内存:7548kb
  • [2024-09-28 06:10:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[500005];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n; cin >> n;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	sort(a+1, a+1+n);
	ll pre = a[n], cur = 0, ansi = n;
	for(int i = n-1; i >= 1; --i)
	{
		cur += a[i];
		if(cur >= pre) { pre += cur; cur = 0; ansi = i;}
	}
	cout<<n-ansi+1<<endl;
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 63ms
memory: 7460kb

input:

500000
976631732
51389671
729809897
630844317
294721017
903231515
477913449
871071076
636104080
345822085
97441187
499323378
522845426
310022664
199310190
776622973
602672555
646874222
214723272
285341530
962727359
681361226
47426538
272153520
693133904
542337627
556307610
325596239
95738088
5495543...

output:

155101

result:

ok single line: '155101'

Test #2:

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

input:

4
3
4
8
9

output:

3

result:

ok single line: '3'

Test #3:

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

input:

8
20
1
2
13
9
5
8
61

output:

1

result:

ok single line: '1'

Test #4:

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

input:

1
10

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 54ms
memory: 7516kb

input:

500000
488349
25720
365654
316274
147722
452008
239786
436076
318835
173398
49102
250556
262275
155533
100095
388891
302219
324219
107768
143112
481547
341758
23696
136464
347550
272004
279048
163397
48247
275611
118344
461362
410109
2256
76615
358107
240210
265807
435838
408622
38878
336952
171230
...

output:

154891

result:

ok single line: '154891'

Test #6:

score: 0
Accepted
time: 63ms
memory: 7456kb

input:

500000
999511652
999974281
999634347
999683727
999852279
999547993
999760215
999563925
999681166
999826603
999950899
999749445
999737726
999844468
999899906
999611110
999697782
999675782
999892233
999856889
999518454
999658243
999976305
999863537
999652451
999727997
999720953
999836604
999951754
999...

output:

262172

result:

ok single line: '262172'

Test #7:

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

input:

30
16
268435456
2048
32768
16777216
65536
131072
536870912
67108864
512
8
4194304
524288
4
1
8388608
33554432
262144
8192
256
32
2097152
128
4096
16384
1048576
134217728
64
1024
2

output:

1

result:

ok single line: '1'

Test #8:

score: 0
Accepted
time: 60ms
memory: 7528kb

input:

500000
976652749
51071855
732379151
633144920
294813539
904339860
479425162
872870196
638243905
346103305
97915062
501226286
524611259
310395471
199822607
779333750
605147990
648957289
215290850
285495798
962916507
684091230
47001297
272454876
695820020
543917748
558282177
326357439
96212988
5512266...

output:

154742

result:

ok single line: '154742'

Test #9:

score: 0
Accepted
time: 55ms
memory: 7548kb

input:

500000
653912
25720
370223
316974
147722
503094
239791
469456
319623
173398
49102
250570
262309
155533
100095
398057
302581
325201
107768
143112
606296
343747
23696
136464
350034
272070
279150
163397
48247
275690
118344
527503
426964
2256
76615
361714
240215
265850
469055
424778
38878
338612
171230
...

output:

190555

result:

ok single line: '190555'

Test #10:

score: 0
Accepted
time: 51ms
memory: 7540kb

input:

500000
655230
25720
370212
316954
147722
502533
239789
469006
319615
173398
49102
250563
262302
155533
100095
398151
302574
325220
107768
143112
607471
343694
23696
136464
349971
272058
279140
163397
48247
275679
118344
526711
426747
2256
76615
361671
240213
265842
468553
424623
38878
338570
171230
...

output:

200853

result:

ok single line: '200853'

Test #11:

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

input:

43
8
832040
233
1597
121393
24157817
4181
39088169
317811
3524578
9227465
165580141
10946
3
1
433494437
196418
6765
5702887
267914296
13
28657
34
377
987
701408733
514229
21
144
2
2178309
102334155
610
63245986
5
2584
1346269
14930352
89
46368
55
75025
17711

output:

3

result:

ok single line: '3'

Test #12:

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

input:

31
12
202383360
1544
24705
12648960
49410
98820
404766720
50595840
386
6
3162240
395280
3
1
6324480
25297920
197640
6176
193
24
1581120
96
3088
12352
790560
101191680
48
772
2
809533440

output:

1

result:

ok single line: '1'

Test #13:

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

input:

30
15
268435455
2047
32767
16777215
65535
131071
536870911
67108863
511
7
4194303
524287
3
1
8388607
33554431
262143
8191
255
31
2097151
127
4095
16383
1048575
134217727
63
1023
2

output:

1

result:

ok single line: '1'

Test #14:

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

input:

31
9
134217729
1025
16385
8388609
32769
65537
268435457
33554433
257
5
2097153
262145
3
1
4194305
16777217
131073
4097
129
17
1048577
65
2049
8193
524289
67108865
33
513
2
536870913

output:

26

result:

ok single line: '26'

Test #15:

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

input:

31
12
199229440
1520
24320
12451840
48640
97280
398458880
49807360
380
6
3112960
389120
3
1
6225920
24903680
194560
6080
190
24
1556480
95
3040
12160
778240
99614720
48
760
2
796917759

output:

30

result:

ok single line: '30'