QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#55475 | #4984. 集合划分 | YL1F4 | 0 | 55ms | 6188kb | C++20 | 771b | 2022-10-13 22:32:46 | 2022-10-13 22:32:50 |
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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 2ms
memory: 3764kb
input:
3 1000000000 1000000000 1000000000
output:
ZYB
result:
ok good
Test #2:
score: -10
Wrong Answer
time: 2ms
memory: 3580kb
input:
3 1000000000 500000000 500000000
output:
BZY
result:
wrong answer read BZY but expected Internationale!
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
4 4 4 4 4
output:
ZYBZ
result:
wrong answer read ZYBZ but expected Internationale!
Subtask #4:
score: 0
Wrong Answer
Test #20:
score: 28
Accepted
time: 55ms
memory: 6092kb
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: 39ms
memory: 6188kb
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: 32ms
memory: 6108kb
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:
0%