QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422145#4984. 集合划分wtc#100 ✓39ms7244kbC++14834b2024-05-26 20:50:502024-05-26 20:50:50

Judging History

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

  • [2024-05-26 20:50:50]
  • 评测
  • 测评结果:100
  • 用时:39ms
  • 内存:7244kb
  • [2024-05-26 20:50:50]
  • 提交

answer

#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=(l);i<=(r);++i)
#define fd(i,l,r) for(int i=(l);i>=(r);--i)
#define fu(i,l,r) for(int i=(l);i<(r);++i)
#define ll long long
using namespace std;
const int N=200007;
int n,l,r,b[N],p[N];ll a[N],s,s1,s2;char ans[N];
bool cmp(int x,int y){return a[x]<a[y];}
int main()
{
	scanf("%d",&n);
	fo(i,1,n) scanf("%lld",&a[i]),s+=a[i],b[i]=i;
	sort(b+1,b+n+1,cmp);
	if(a[b[n]]*2>=s) return !printf("Internationale!");
	r=n+1;l=0;
	fd(i,n,1)
	{
		if((n-i)&1) p[--r]=b[i];
		else p[++l]=b[i];
	}
	l=0;r=n+1;
	while((s1+a[p[l+1]])*2<s) l++,s1+=a[p[l]];
	while((s2+a[p[r-1]])*2<s) r--,s2+=a[p[r]];
	if((s-s1-s2)*2>=s) return !printf("Internationale!");
	fo(i,1,l) ans[p[i]]='Z';
	fo(i,l+1,r-1) ans[p[i]]='Y';
	fo(i,r,n) ans[p[i]]='B';
	fo(i,1,n) printf("%c",ans[i]);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3824kb

input:

3
1000000000 1000000000 1000000000

output:

YBZ

result:

ok good

Test #2:

score: 10
Accepted
time: 1ms
memory: 3788kb

input:

3
1000000000 500000000 500000000

output:

Internationale!

result:

ok good

Test #3:

score: 10
Accepted
time: 1ms
memory: 5820kb

input:

3
999999999 1 999999999

output:

BYZ

result:

ok good

Test #4:

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

input:

3
929738476 618498375 587919466

output:

ZBY

result:

ok good

Subtask #2:

score: 16
Accepted

Dependency #1:

100%
Accepted

Test #5:

score: 16
Accepted
time: 1ms
memory: 5920kb

input:

16
877252695 183754899 475408771 597903894 859911967 724303221 150613599 310906906 73874354 375118473 441289029 26118394 224202440 665877319 291114614 998244353

output:

BBZBZBBBBZBBBZYZ

result:

ok good

Test #6:

score: 16
Accepted
time: 0ms
memory: 3880kb

input:

16
43482942 29517049 439574018 16651924 4128721 3205521 18287229 39125746 43668413 42879435 30629564 43572722 49312340 5885984 46559565 22639663

output:

Internationale!

result:

ok good

Test #7:

score: 16
Accepted
time: 0ms
memory: 3796kb

input:

4
989236784 989236784 989236784 989236784

output:

Internationale!

result:

ok good

Test #8:

score: 16
Accepted
time: 0ms
memory: 3880kb

input:

16
7045386 132645525 5329347 995508153 42922629 125090238 13657841 113192079 119255247 995508153 45414617 995508153 40498115 144856305 97501072 108099752

output:

BYBYBBBBBBBZBBBB

result:

ok good

Test #9:

score: 16
Accepted
time: 0ms
memory: 5916kb

input:

16
811973434 50622271 80555208 811973434 183405608 41859257 192662749 97374058 30045626 146411393 38366318 121541545 2289752 236279946 214022076 188511061

output:

BBYZZBZBBBBZBZBB

result:

ok good

Test #10:

score: 16
Accepted
time: 1ms
memory: 5920kb

input:

16
244140 15624960 488280 124999680 249999360 499998720 3906240 999997440 7812480 31249920 999997440 1953120 999997440 244140 976560 62499840

output:

BBBBYBBYBBBBZBBB

result:

ok good

Test #11:

score: 16
Accepted
time: 1ms
memory: 5964kb

input:

15
31249920 15624960 1953120 499998720 976560 62499840 122070 3906240 124999680 249999360 244140 999997440 488280 122070 7812480

output:

Internationale!

result:

ok good

Test #12:

score: 16
Accepted
time: 1ms
memory: 5908kb

input:

16
122066 124995584 122066 62497792 3906112 499982336 488264 122066 1953056 15624448 976528 244132 7812224 31248896 249991168 999964672

output:

BBBBBBBBBBBBBBYZ

result:

ok good

Test #13:

score: 16
Accepted
time: 1ms
memory: 5920kb

input:

16
170620811 164317798 892841510 37751113 1200945 42963939 38783177 165207092 35998230 46418701 178415227 20193152 100539938 51582078 150679037 130049620

output:

ZYZBBBBBBBBBBBBB

result:

ok good

Subtask #3:

score: 16
Accepted

Test #14:

score: 16
Accepted
time: 1ms
memory: 5920kb

input:

4
4 4 4 4

output:

Internationale!

result:

ok good

Test #15:

score: 16
Accepted
time: 1ms
memory: 5852kb

input:

1000
992 694 925 241 830 272 739 329 894 885 976 194 922 892 294 133 214 508 346 809 820 906 740 806 260 656 714 379 418 72 773 373 766 554 204 569 694 222 430 580 119 84 817 8 944 765 340 598 471 301 902 676 52 324 722 777 717 332 814 384 753 773 216 190 233 126 796 492 926 860 917 344 689 236 238 ...

output:

ZZZZBBBBBZZZZZBZBBZZBZZZZZBBBZBBZBZBZBZBBBBBZBBZZZZZBZZBZBZZZBBZZBBZBBBZZZZZBZBZZZZBBBBZZBZBZZBBBZBZBBZBZZBZBZBZBZBZZZBZZBZBZBBBBZBZZBBBBBZBBZZBBBZZBBBZZBZBBZZBBBBBZZBZBBZZBBZBZBBZBZBZBZBZBZZBBZBZZBBBZZBBZBZZBZZBZBBBBBZZBZBZZZZBBZBZZBBZZZBBZZZZZZZZBBZBZBZZBBBBZZBBBBZZBBBBZBBBBBZZZBZZZZZZZZZZZBBZBZBZ...

result:

ok good

Test #16:

score: 16
Accepted
time: 0ms
memory: 3892kb

input:

1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

Internationale!

result:

ok good

Test #17:

score: 16
Accepted
time: 1ms
memory: 5912kb

input:

1000
2 1 3 1 5 5 2 1 1 2 1 2 6 1 2 2 2 1 2 1 7 5 2 1 1 7 57 1 9 2 4 4 2 2 1 2 2 16 1 8 2 2 9 2 1 2 1 2 1 2 2 8 2 1 1 2 2 5 9 8 2 2 8 81 3 2 2 9 1 10 10 1 2 8 2 2 39 1 6 2 2 1 1 1 864 1 9 2 2 1 2 1 5 10 1 1 1 2 7 1 2 8 2 1 2 2 1 2 1 2 9 10 8 7 1 2 8 7 2 2 1 3 1 1 2 1 2 2 2 6 5 1 2 1 1 1 5 2 2 1 6 6 2...

output:

ZBZZZBZZZBZBBBZBBBZZZZBZBBBZBZBZZZZZZZZBZZBZZZBZBBZBZBBBBBBZZZZZZBZZZZZBBZZBZBZZZBZZBZBBBBZBBBBZZZBBZBZBZZZBZBBBZZBBBBZBZZBBBBBZBBBBBZBBZZZBBBBZZZBBBZZBZBBBZBBBZBZZZBZBZZZBBZZBBZBZZBZZZBBBBZZBBZZBZZBZBZBBZZZBBZBZZBBBBBBBBZBZBZBBZZZZBBBZBZZBBBZZZBBZZBBBBBZBBZBBBZBBBBBBBZZBBBBBBZBBZZBZBBZBZZZZBBZZZBBB...

result:

ok good

Test #18:

score: 16
Accepted
time: 0ms
memory: 5920kb

input:

6
1 2 3 4 5 6

output:

BYBZBZ

result:

ok good

Test #19:

score: 16
Accepted
time: 1ms
memory: 5928kb

input:

1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

ZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZZBZBZBZBZBZBZBZBZBZ...

result:

ok good

Subtask #4:

score: 28
Accepted

Test #20:

score: 28
Accepted
time: 39ms
memory: 7220kb

input:

200000
251675892 235004283 221041034 884668549 981884658 228429505 714196716 195140474 665123295 357898116 722288111 729369527 263559507 598894 185389002 759324351 483223129 645970409 945698838 154622546 45194151 614739717 460894345 914167450 715294016 617080062 274331915 226690918 422176349 3323768...

output:

BZBZBBZBBZZZZBZBZZBZZBZBZZBZBBZZBBBBZBBBZZZZZZZBBZBBZZZBBZZZBZZZZBBBZBBBBZZBZBZZZBBZZZBBBBBZBBZBBZZZBZBZBZBZZZZZBBZBZBZBZZZBZBBBBZBBBZZZBZZZZZBBZZBZBBBZBBZZBBBZZZBZBZBZZBBBZBZBZBBZZBZBBBBZBBZZZBZZZBZZZZZZBBZBZBBZZZBBZBZBZBZBZZBBZZBBBZBZBZZZZZBBZZZBBBZBBBZBBZZZBZBZZZZZZBBBBZBBZBBZBZZBBBZBBBBZZBBZZZBB...

result:

ok good

Test #21:

score: 28
Accepted
time: 22ms
memory: 7244kb

input:

200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...

output:

BBZBZBZBZBZBZBZBZBZBZBZBZZBZBZBZBZBZBBBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBBBZBZBZBZBZBZBZBZBZBZBZBZZBZBZBZBZBZBBBZBZBZBZBZBZZBZBZBZBZBZBZBZBZBZBZBZBBZBZBZBZBZBZZZBZBZBZBZBZZZBZBZBZBZBZBZBZBZBZBZBZBBZBZBZBZBZBZZZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZBZZZBZBZBZ...

result:

ok good

Test #22:

score: 28
Accepted
time: 36ms
memory: 7100kb

input:

200000
1205 7802 12248 5941 7506 3737 1143 3080 5301 1783 12537 8890 15307 27555 16541 12146 864 12793 443 1952 372 4922 23118 9864 15395 6152 35849 16355 256 998 4202 3052 21064 19453 90 15390 105632 17243 4685 5371 10575 14661 9988 17799 5202 8231 1622 3770 1677 10312 5968 1115 12297 20816 22345 9...

output:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok good

Test #23:

score: 28
Accepted
time: 37ms
memory: 7232kb

input:

200000
5675 6990 5159 5151 6512 6207 5330 5357 5537 5553 18718 5165 6055 5985 5703 5591 5024 6976 5326 6808 5125 5398 5070 5962 5003 6426 5261 7204 5254 5353 5388 5005 5098 4970 5063 5159 8158 6947 5443 7889 6316 5306 5124 4971 7276 4995 5158 7826 7019 5779 5890 5220 6039 7941 5480 5214 7015 5846 76...

output:

BBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBBBB...

result:

ok good

Test #24:

score: 28
Accepted
time: 34ms
memory: 7136kb

input:

190626
3810 3023 2632 5282 4392 798 159 7675 1860 7775 5791 5520 1847 4476 5563 3222 5897 764 9509 248 3668 5279 2685 1335 4180 8821 9347 6127 2475 2076 12407 2315 6258 9357 4394 2069 5296 4055 9467 731 11964 4841 6495 9940 1677 13084 19376 13750 1120 6636 3452 630 9588 52390 3276 3943 5285 4859 899...

output:

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

result:

ok good

Test #25:

score: 28
Accepted
time: 38ms
memory: 7024kb

input:

190228
2034 15134 3382 6155 11052 2769 330 10963 4295 11207 8011 3141 7404 3842 5492 769 9088 5318 2982 4194 8143 11086 11450 6609 5206 10537 8221 4352 7949 1489 2660 8026 5897 41492 1616 10466 5967 7705 1465 8365 3914 10687 2560 13662 13383 3712 15492 5446 116 4386 8529 12970 1264 9409 1526 8047 13...

output:

BZZZBBBBZBZZZBBBBZZZZBZZBZZBZZZZBZZBBZZBZZBBZZZBBZBZZZZBBZZBZBBBZBBZZZBZZZBBZBBZZZZZZBZZBBBZZBZZBBBZZZBBZBZZZBBBBZZBBBBZBZBZBBBZZZBBZZZBBBBBZZZBBBZBZBBBZBZZBBZZBBZZBZBZZBBZZBZZZBBBBBBBZBZBBZBZZZZZZBBBBBBBZZZBBZBZZZZZZZBZZZBZZZZBBZZBZBZBZZBZZZZZZZZBBBZBBBBBZBBBBBBBBBBZZZZZZZZBZZBBZZBBZZZZZBZZZZZZBZBB...

result:

ok good

Subtask #5:

score: 30
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #26:

score: 30
Accepted
time: 24ms
memory: 6936kb

input:

200000
7340 3856 5419 5394 2691 6106 11439 6179 4169 7459 4486 721 709 6037 3184 13122 9319 21273 2864 6157 8903 4663 5450 5959 565 2252 1808 2046 4477 1401 4482 7350 5165 1958 4943 3592 3720 1058 12645 9102 624 2225 1975 2232 795 600 1806 3805 1730 7679 3765 9300 6018 4184 5824 5166 5096 5339 10740...

output:

Internationale!

result:

ok good