QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55476 | #4984. 集合划分 | YL1F4 | 26 | 36ms | 6192kb | C++20 | 772b | 2022-10-13 22:33:15 | 2022-10-13 22:33:17 |
Judging History
answer
#include <bits/stdc++.h>
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int N = 2e5 + 7;
int n, c[N];
long long p[7];
pii a[N];
int main(){
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d", &a[i].fi), a[i].se = i;
sort(a + 1, a + n + 1);
for(int i = 1; i <= n; i++){
if(p[1] <= p[2] && p[1] <= p[3]) p[1] += a[i].fi, c[a[i].se] = 1;
else if(p[2] <= p[1] && p[2] <= p[3]) p[2] += a[i].fi, c[a[i].se] = 2;
else p[3] += a[i].fi, c[a[i].se] = 3;
}
long long s = p[1] + p[2] + p[3];
if(max({p[1], p[2], p[3]}) * 2 >= s) printf("Internationale!\n");
else{
for(int i = 1; i <= n; i++) printf(c[i] == 1 ? "Z" : (c[i] == 2 ? "Y" : "B"));
printf("\n");
}
return 0;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 2ms
memory: 3580kb
input:
3 1000000000 1000000000 1000000000
output:
ZYB
result:
ok good
Test #2:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
3 1000000000 500000000 500000000
output:
Internationale!
result:
ok good
Test #3:
score: 0
Accepted
time: 2ms
memory: 5684kb
input:
3 999999999 1 999999999
output:
YZB
result:
ok good
Test #4:
score: 0
Accepted
time: 2ms
memory: 3788kb
input:
3 929738476 618498375 587919466
output:
BYZ
result:
ok good
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #5:
score: 16
Accepted
time: 2ms
memory: 3700kb
input:
16 877252695 183754899 475408771 597903894 859911967 724303221 150613599 310906906 73874354 375118473 441289029 26118394 224202440 665877319 291114614 998244353
output:
BZZYYZBZYYBZYBBZ
result:
ok good
Test #6:
score: 0
Accepted
time: 1ms
memory: 3788kb
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: 0
Accepted
time: 2ms
memory: 5748kb
input:
4 989236784 989236784 989236784 989236784
output:
Internationale!
result:
ok good
Test #8:
score: 0
Accepted
time: 2ms
memory: 3864kb
input:
16 7045386 132645525 5329347 995508153 42922629 125090238 13657841 113192079 119255247 995508153 45414617 995508153 40498115 144856305 97501072 108099752
output:
YBZYYYBBZBBZZZZY
result:
ok good
Test #9:
score: 0
Accepted
time: 2ms
memory: 5832kb
input:
16 811973434 50622271 80555208 811973434 183405608 41859257 192662749 97374058 30045626 146411393 38366318 121541545 2289752 236279946 214022076 188511061
output:
BYBZZZBZYBBYZYZY
result:
ok good
Test #10:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
16 244140 15624960 488280 124999680 249999360 499998720 3906240 999997440 7812480 31249920 999997440 1953120 999997440 244140 976560 62499840
output:
ZYBYBZBYZBBYZYZZ
result:
ok good
Test #11:
score: 0
Accepted
time: 1ms
memory: 3712kb
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
Wrong Answer
time: 2ms
memory: 3856kb
input:
16 122066 124995584 122066 62497792 3906112 499982336 488264 122066 1953056 15624448 976528 244132 7812224 31248896 249991168 999964672
output:
Internationale!
result:
wrong answer read Internationale! but there's a valid solution
Subtask #3:
score: 16
Accepted
Test #14:
score: 16
Accepted
time: 2ms
memory: 3856kb
input:
4 4 4 4 4
output:
Internationale!
result:
ok good
Test #15:
score: 0
Accepted
time: 2ms
memory: 3824kb
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:
YYZZBBZBBYZZYZBYZYBBBYYBYZZZZZYYYBBBBYBYZYZYBZBYYYYZBYZBBBYBYBBYZYZBZYZZZZZBBYZZYBYZZBZYZYZYYYZZYZYYBBYZBZYYYZZBBBBZYBZZYYZZZBZZYYBYYYZYZYYBBZZYYZBZZYYZBYBYYBZYZZBZYZZYBZBZYBZZBBZBYZBYYYYZYYBYBZBBZZBZZZZZZBBYZBBYBBYBZYZBZYYYBBYZYYBBBBYBBZYZBYZBZZBBBZBBYBZYBZYZBYZZBZBZZBYBYBZBBYZYYBBZBYZZZBYBYBYBYBZZ...
result:
ok good
Test #16:
score: 0
Accepted
time: 2ms
memory: 3752kb
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: 0
Accepted
time: 2ms
memory: 3652kb
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:
YZZYYBBBZZYYZBBZYZBYYZZBZBYYBYZYBZBYBBZBZYZBYZBYZBZZYYBBZYYYYBBBYZYBZYBYBZZYZBYBZZYBBZZYBYZBBZZYBYZZBYZYYBBZZYYYBYYBZBZYBBZYBBZYBBZZZYBZYYBYZYZBYBBZZBZYYBZZBBYBZBYBZZYYYBBZZBYYBZYZBYYBZBZYYYZBYZYBZYZZBZBBYBYYZYBBZZYBZYZBYBZZYBBYZZZYZBZBYYBZZBYYYBZZYZBBZYZBZYYBZYBBZYBZYZBZYBBZYYBZYBYBZZYBYBYZBYZBZBYZ...
result:
ok good
Test #18:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
6 1 2 3 4 5 6
output:
ZYBZYB
result:
ok good
Test #19:
score: 0
Accepted
time: 0ms
memory: 5832kb
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:
ZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYB...
result:
ok good
Subtask #4:
score: 0
Wrong Answer
Test #20:
score: 28
Accepted
time: 36ms
memory: 5976kb
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:
YBZYZYBYZZZBBBBBZZYBBBBZYBBYYZBBYBYBBBBBYBZYYYZBBZYBYBYYYYYBYYZYYBZBZZYBBYBYBBZZBYZYYZZZZZYYBBZYYBBZBZZBZBZYBZZBYZYYZZYBZYZYZBZZZYZBZYZZBZZZBYYYYYBZZYBZYBYZZBYZBZYYZBZBZBBZZYYYYZBYYYZZYYZYYYZZZZZZBZZZBZZYYBZBZZYZZBBBYYBYBYYYZBBBZZZZYYZBBYZYBBYZZBZYBZYYZZZYZZZZBZZZYYBBZZYZYZBBZYYBZZZBZZYZZYYZBBBZBBZY...
result:
ok good
Test #21:
score: 0
Accepted
time: 35ms
memory: 6192kb
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:
ZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYBZYB...
result:
ok good
Test #22:
score: -28
Wrong Answer
time: 30ms
memory: 6148kb
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:
Internationale!
result:
wrong answer read Internationale! but there's a valid solution
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%