QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#422152 | #4984. 集合划分 | wtc# | 38 | 34ms | 6380kb | C++14 | 735b | 2024-05-26 20:59:01 | 2024-05-26 20:59:02 |
Judging History
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];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!");
for(int i=1;i<n-i;++i) swap(b[i],b[n-i]);
l=0;r=n+1;
while((s1+a[b[l+1]])*2<s) l++,s1+=a[b[l]];
while((s2+a[b[r-1]])*2<s) r--,s2+=a[b[r]];
fo(i,1,l) ans[b[i]]='Z';
fo(i,l+1,r-1) ans[b[i]]='Y';
fo(i,r,n) ans[b[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: 0ms
memory: 3768kb
input:
3 1000000000 1000000000 1000000000
output:
YZB
result:
ok good
Test #2:
score: 0
Accepted
time: 1ms
memory: 5880kb
input:
3 1000000000 500000000 500000000
output:
Internationale!
result:
ok good
Test #3:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
3 999999999 1 999999999
output:
ZYB
result:
ok good
Test #4:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
3 929738476 618498375 587919466
output:
BZY
result:
ok good
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #5:
score: 16
Accepted
time: 0ms
memory: 3752kb
input:
16 877252695 183754899 475408771 597903894 859911967 724303221 150613599 310906906 73874354 375118473 441289029 26118394 224202440 665877319 291114614 998244353
output:
ZBBYZZBBBBBBBZBB
result:
ok good
Test #6:
score: 0
Accepted
time: 0ms
memory: 3772kb
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
Wrong Answer
time: 0ms
memory: 3848kb
input:
4 989236784 989236784 989236784 989236784
output:
YYZB
result:
wrong answer read YYZB but expected Internationale!
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 5888kb
input:
4 4 4 4 4
output:
YYZB
result:
wrong answer read YYZB but expected Internationale!
Subtask #4:
score: 28
Accepted
Test #20:
score: 28
Accepted
time: 31ms
memory: 6380kb
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:
BBBZZBZBBBZZBBBZBBZBBBBZZBBBBBBBBBBBBBBZBBBBBBZBBZZBBBZBBBBZBBZBBZZBBZZBBBBBZZBBBBBBBBZBBZZBBBBBBBBBBBBZBBBBZZBBBBBBBZBZBBBBBZBZZBBZZZBZBZZBBBBBBBBBBBZBZZZBBBZBBZBBBBZBBBBBBBZZZBZZBZBBZBBBBBBBBBBBZBBBZBBZBBZBBBBZBZZBZZZBBBBZZZBZBBBZBZBBZZZBBZBBBBBBBBBZBBBBBZBBZZBBBBBBBZZBBBBBBBBBBZBBZBBZBZZBBBZBBZBB...
result:
ok good
Test #21:
score: 0
Accepted
time: 23ms
memory: 6372kb
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:
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ...
result:
ok good
Test #22:
score: 0
Accepted
time: 23ms
memory: 6216kb
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:
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ...
result:
ok good
Test #23:
score: 0
Accepted
time: 30ms
memory: 6304kb
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:
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
result:
ok good
Test #24:
score: 0
Accepted
time: 33ms
memory: 6192kb
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: 0
Accepted
time: 34ms
memory: 6288kb
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:
BZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZBBBBBBBBBBBBZBBBBBBBBBBBZZBBBBBBBBBBBBBBBBBBBZZZBBBBBBBBBZZBZBBBBBBZBBBBBBZBBBZZBBBBZBZBBBBBBBBBBZBZBZBBBBBBBZBBBBBZBBZBZBZBBBBZBZBBZBZBBBBBBBBBZBBBBBZBBBBBBBBBBZBBBBBBZBBBBBBBBBZBBBBBBZBZZBZBBBZZBBBBZBBBBBZBBBBZBBBBZBBZBBBBBBZBBBBBZBBBBZBZBBBBBZBBBBZZBBBZZBBZBBBBBB...
result:
ok good
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%