QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60119 | #1901. Third Group Exam | abdelrahman001# | WA | 8ms | 4008kb | C++20 | 1.1kb | 2022-11-02 22:39:05 | 2022-11-02 22:39:06 |
Judging History
answer
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 1e5 + 5;
int n, a, b, x[N], y[N], ans;
char c[N];
vector<pair<int, int>> v;
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> a >> b;
for(int i = 0;i < n;i++)
cin >> x[i];
for(int i = 0;i < n;i++) {
cin >> y[i];
v.push_back({x[i] - y[i], i});
}
sort(v.rbegin(), v.rend());
for(int i = 0;i < a;i++) {
int idx = v[i].second;
c[idx] = 'T';
ans += x[idx];
}
reverse(v.begin(), v.end());
for(int i = 0;i < b;i++) {
int idx = v[i].second;
c[idx] = 'P';
ans += y[idx];
}
for(int i = b;i < n - a;i++) {
int idx = v[i].second;
if(x[idx] > y[idx]) {
c[idx] = 'T';
ans += x[idx];
} else {
c[idx] = 'P';
ans += y[idx];
}
}
cout << ans << '\n';
for(int i = 0;i < n;i++)
cout << c[i] << " ";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
4 1 1 10 30 50 70 80 60 40 20
output:
260 P P T T
result:
ok All checks passed
Test #2:
score: 0
Accepted
time: 2ms
memory: 3596kb
input:
4 1 1 30 40 60 90 10 25 50 85
output:
215 T T T P
result:
ok All checks passed
Test #3:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
4 2 1 0 17 70 13 2 21 55 99
output:
190 T P T P
result:
ok All checks passed
Test #4:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
1 0 0 6 5
output:
6 T
result:
ok All checks passed
Test #5:
score: 0
Accepted
time: 2ms
memory: 3476kb
input:
1 0 0 92 91
output:
92 T
result:
ok All checks passed
Test #6:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
11 0 3 86 28 96 80 96 62 70 25 88 89 85 64 9 87 47 49 73 72 35 93 63 71
output:
833 T T T T T P P P P T T
result:
ok All checks passed
Test #7:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
11 5 0 76 59 53 71 64 72 80 59 51 59 87 99 78 78 76 60 97 70 87 88 59 84
output:
888 P P P T T P T P P T T
result:
ok All checks passed
Test #8:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
11 0 0 16 36 80 20 37 4 15 7 32 81 45 63 53 75 1 20 7 80 65 1 46 8
output:
563 P P T T T P P P T T T
result:
ok All checks passed
Test #9:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
11 3 3 92 79 82 71 59 56 94 89 79 88 78 69 62 69 95 52 69 67 82 88 92 79
output:
918 T T T P T P T T P P P
result:
ok All checks passed
Test #10:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
11 1 2 36 65 64 73 91 47 28 1 9 27 6 62 74 18 35 24 54 77 95 64 97 57
output:
808 P P T T T P P P P P P
result:
ok All checks passed
Test #11:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
11 0 0 56 75 61 72 54 91 80 68 82 65 68 91 95 60 89 96 67 89 52 61 50 72
output:
899 P P T P P T P T T T P
result:
ok All checks passed
Test #12:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
11 0 0 18 18 6 95 34 96 91 17 93 95 33 81 43 7 2 90 15 64 58 65 1 37
output:
786 P P P T P T T P T T P
result:
ok All checks passed
Test #13:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
11 0 0 85 87 69 65 82 76 78 71 53 61 72 86 100 50 79 59 76 51 87 61 50 89
output:
868 P P T P T P T P P T P
result:
ok All checks passed
Test #14:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
11 0 0 10 25 42 37 46 68 100 100 2 31 76 13 62 29 91 32 61 60 71 97 92 34
output:
787 P P T P T T T T P P T
result:
ok All checks passed
Test #15:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
11 0 0 88 87 52 55 93 87 93 78 99 57 84 60 66 81 81 87 90 74 74 86 62 54
output:
936 T T P P T P T T T P T
result:
ok All checks passed
Test #16:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
11 4 5 60 56 52 45 43 62 53 39 55 49 61 71 64 55 24 21 87 56 12 63 37 83
output:
655 P P P T T P P T P T P
result:
ok All checks passed
Test #17:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
11 1 1 47 25 34 40 57 43 71 78 25 72 40 40 43 49 49 46 40 58 59 41 59 45
output:
595 T P P P T T T T P T P
result:
ok All checks passed
Test #18:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
11 4 5 52 58 56 55 60 49 63 55 42 46 44 33 66 63 58 73 29 91 40 11 20 16
output:
639 T P P P P T P T T T T
result:
ok All checks passed
Test #19:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
11 1 1 50 22 23 50 74 76 31 33 42 66 78 54 39 36 46 67 65 43 45 49 62 66
output:
610 P P P T T T P P P T T
result:
ok All checks passed
Test #20:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
11 4 5 50 63 44 48 61 46 46 54 63 53 35 54 93 17 25 91 21 22 74 96 62 2
output:
689 P P T T P T T P P P T
result:
ok All checks passed
Test #21:
score: 0
Accepted
time: 3ms
memory: 3668kb
input:
11 1 1 61 58 52 30 44 61 32 26 29 65 69 56 58 55 44 52 56 42 43 43 47 51
output:
593 T P P P P T P P P T T
result:
ok All checks passed
Test #22:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
500 0 139 90 36 25 41 10 38 31 26 71 36 51 54 75 46 74 35 66 1 44 56 44 49 26 73 5 9 94 97 59 65 17 63 13 74 92 28 95 50 41 61 95 52 43 37 70 26 55 86 8 65 7 38 79 79 43 34 29 71 38 84 13 10 66 87 54 90 27 99 27 85 93 27 32 21 31 83 88 84 1 97 11 44 24 47 83 20 33 41 24 28 43 33 91 21 57 9 28 95 67 ...
output:
33697 T P T T T T P T T T P T T P T P T P P P T T P T P P T T T T P T P P P P T T P T T P T T T T T T P T P T P T P P P T P T P P T T T T T T P T T P T P T P T T P T P P P T T P P P P P P P T P T P P T T P T T P P P T T T P P P T P T P P P T T P P T P T P T T P T T P P P T T T P P T P P T P P T P T ...
result:
ok All checks passed
Test #23:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
500 0 257 74 70 74 94 78 84 60 80 65 52 98 73 77 87 66 83 97 88 74 81 65 71 91 54 95 94 96 94 68 54 81 66 65 88 90 66 83 62 80 77 84 57 51 73 82 60 78 84 82 60 62 79 93 99 91 96 62 77 81 92 74 65 60 55 83 89 97 53 65 66 77 58 85 58 53 82 98 54 89 71 60 96 81 78 73 100 93 79 76 73 85 74 69 92 67 65 5...
output:
42042 T P T T P T T T P P T T P P T P T P P P P P T P T T T T T P P T P T T T P T T T T P P P T P T P T P P P T T T T T T T T P P P P P P P P P T T P P T P T T P P T P T T P P T T P P T P P P T T P P P P P P P P P T T P P T P P T P T P P P T P P P P P P T T P T T P T T P T P T T P P P T T P P T P P ...
result:
ok All checks passed
Test #24:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
500 126 95 9 43 77 94 53 46 77 87 15 28 11 14 48 7 49 34 21 9 9 22 64 93 62 12 13 81 36 8 87 21 4 42 7 77 83 100 21 25 6 0 16 23 35 50 15 93 18 9 71 93 90 22 7 70 22 98 59 95 34 31 59 66 60 42 9 81 48 92 13 25 87 93 26 60 100 35 99 42 25 54 11 50 45 55 60 93 24 74 96 15 14 63 90 29 5 45 8 62 89 64 6...
output:
33547 P T T P P T P T P P T P P P T T T P P P P T T P P T P P T P P P P T T T P P T P T P P P P T P P T T T P P T P T T T T P T T T T P T P T P T T T P T T T T P P T P T T P P T T T T P T T T P P T P P T T P P T P T T P P T T T T T P P T T P T P P T T P P P T P P T P T T T T P T T P P T T P P P P P ...
result:
ok All checks passed
Test #25:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
500 57 57 89 65 79 95 98 95 98 60 92 81 87 68 53 84 51 56 77 61 78 51 56 92 82 99 82 60 52 99 100 87 86 92 81 84 52 80 51 87 91 65 62 56 93 93 50 87 91 72 88 62 91 65 67 79 89 63 97 69 56 87 72 84 54 86 53 52 98 99 85 61 76 91 71 57 65 70 59 69 76 97 66 78 72 97 74 88 69 95 97 54 64 100 88 89 77 74 ...
output:
41630 T P P T T T P P P T T P P T P P P P T P P T P T T P P T T P P T P T P P P T P P P P T P P T T P T T T P P P P T T T P T P P P T P P T T T T T T P P P T P T P T T P P T P T T T T P T T T T T T T P T T P P T P P P P P P P P P T P T T P T T T P P P P T T T P P P T P T T T P P P T T T P T T P T T ...
result:
ok All checks passed
Test #26:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
500 15 30 29 40 28 34 5 89 90 2 36 9 16 40 9 12 35 12 12 74 97 99 60 69 87 73 54 96 57 20 57 10 92 21 91 11 38 27 91 34 61 51 37 95 49 74 72 14 93 45 23 99 37 63 37 49 47 60 32 6 98 55 84 10 54 32 65 40 70 84 33 34 16 68 53 30 2 56 98 33 72 11 43 100 22 96 4 33 27 74 45 70 87 49 21 70 89 48 89 62 10...
output:
32802 P P P T P T T P P P P T P P T P P T T T P P T P T T T P T P T P P P P T T T T T T T P T P T T T T T T T P P P P P P T P T P P T T T T T P T P T P P P P T P T P P T T T P P T T P P T T P P T P T P P P T P P T T T P P T T T P P P T P P T T P T T P T P T P T T T P P T T T P P T P P P P P T T P P ...
result:
ok All checks passed
Test #27:
score: 0
Accepted
time: 2ms
memory: 3632kb
input:
500 64 123 54 60 57 70 94 78 60 89 94 59 51 64 52 82 89 56 59 61 57 97 70 61 98 92 95 100 58 53 56 94 92 66 71 54 90 69 68 60 77 77 67 54 56 62 94 63 81 58 94 91 95 75 93 84 89 57 55 85 83 58 69 53 97 93 99 67 99 69 80 82 52 72 56 55 54 60 98 58 88 96 98 85 65 88 75 52 98 60 92 84 93 76 82 83 60 58 ...
output:
41819 P P P T T T P T P T P P P T P P P P P T P P T T T T P P T P T P T P T P T T P T P P P P T T T P P P T T T P T P P T P T P P T T T T T P P P P P P P P T T P T T T P P T T P T P T T T T T T T T T T P T P P P P P T T T P P T T P P P T P P P T T T T T P P T P T P P T T P P P T T P P P P T T T P P ...
result:
ok All checks passed
Test #28:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
500 9 116 42 20 9 94 59 83 82 29 35 81 57 84 30 90 8 50 75 88 25 90 90 12 14 34 15 54 12 46 28 36 58 4 84 94 55 71 85 67 24 37 62 16 0 49 93 61 15 85 95 38 94 25 65 50 90 48 37 74 68 14 7 42 28 8 97 28 19 87 93 47 73 80 32 77 52 60 97 84 21 65 40 1 64 71 70 92 47 94 57 82 1 52 7 52 0 40 58 26 40 95 ...
output:
33453 P P T T P T T P P T T T P T P P T T P T T P P T P P P P P P P P T T T P T T T T T T P P T T P T T P T T T P T P T T T P P P P P T P P P T T T T P T T P T T P T T P T T P P P T T T P T T P P P P P T P T T T P P P T T T T T P P P T P T P T P T P P T T P T P P P P P P T T T T T T T T P P T T T T ...
result:
ok All checks passed
Test #29:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
500 32 308 98 85 57 61 97 91 99 69 69 88 71 62 70 93 86 66 61 52 98 88 50 60 69 68 67 55 85 56 97 78 80 51 85 91 64 97 89 62 92 94 89 55 94 59 93 91 83 74 52 66 66 73 84 71 93 89 61 95 62 62 53 73 88 78 78 57 71 64 79 59 62 52 84 75 70 72 68 58 64 91 86 85 50 97 99 52 51 92 73 93 57 77 87 54 81 62 6...
output:
41349 T P P P T T T T P T P P P T T P P P T P P P T P P P P P T P P P P T P P T P T P T P T P T P T T P P P P T P T T P T P P P T P T T P P P T P P P P T P T T P T T P P P T T P P P P T P T T P P P P T P P P P T P P P T T T P T P T T P P T P P P T T T P P T T T T T P P P T T P T T P T P T P T P T P ...
result:
ok All checks passed
Test #30:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
500 0 0 64 60 76 37 42 75 20 33 85 27 84 18 53 71 90 57 29 4 81 36 7 29 31 32 17 94 25 35 18 37 98 71 75 29 21 80 19 48 55 89 95 49 43 87 78 6 96 32 16 29 50 9 77 55 77 93 41 16 81 68 40 60 25 27 10 1 50 85 17 47 14 84 74 10 12 71 42 81 92 48 1 34 14 49 42 82 56 26 39 58 85 41 93 35 70 25 83 58 7 40...
output:
33644 P P P T P T P T T P T P P T T P T P T P P P P T P T P P P P T P T P P T P T P T T P T T T P T P P T T P T T T T T P T T P T P P P P T T P T P T T P T T T T P P P T P P T T T P P T T T T P T P P T P P P P P T T P P P T T P T P P P T T T P T T P P T P P P T T P T P P T P P T T P T P P P T T P T ...
result:
ok All checks passed
Test #31:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
500 0 0 63 79 97 77 54 51 55 69 73 89 51 69 67 76 57 84 75 94 84 80 95 51 50 92 76 96 83 60 92 59 98 91 66 95 65 84 52 60 64 96 97 100 84 89 75 72 77 52 59 72 52 67 81 53 60 98 84 69 65 91 86 68 99 61 60 64 95 91 68 95 93 63 79 68 63 85 83 99 53 70 50 51 88 50 53 89 79 60 64 54 63 52 76 53 76 55 80 ...
output:
41353 T P T T P P P P P P P P P T P P P T P T T P P T P T T P T P T T P P T T P P T T T T T T T T T P P P P P T P P T T P P T T P T P P T T T P T T P T T T T T T P P P P T P P T T P P P T P T T P P P P T P P T P P P P P P T P P P T P T T P T P T P T P T T T P P T P P T P P P T T T P P P P P P T P T ...
result:
ok All checks passed
Test #32:
score: 0
Accepted
time: 2ms
memory: 3632kb
input:
500 241 236 33 42 63 58 65 56 34 39 57 64 63 39 46 53 46 65 61 39 45 45 53 55 37 34 63 57 38 65 34 37 39 48 41 61 63 51 45 62 58 59 47 48 37 65 39 58 60 54 53 57 63 36 50 40 46 58 65 33 35 60 55 51 56 42 39 62 61 62 56 51 37 48 48 65 61 39 34 36 62 44 64 46 36 44 50 35 62 65 55 55 56 38 63 33 37 36 ...
output:
29201 T T P P P P T T P P P T T P T P P T T T P P T T P P T P T T T T T P P P T P P P T T T P T P P P P P P T T T T P P T T P P P P T T P P P P P T T T P P T T T P T P T T T T T P P P P P T P T T T T P T T T T T T P T T T P T T P P T T T T T T T T P P P T T P T P P T T P T T P T P P T P T P T P T P ...
result:
ok All checks passed
Test #33:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
500 60 50 67 65 21 54 32 67 67 40 35 31 64 63 74 34 59 52 68 32 45 36 42 73 69 45 63 68 45 56 74 35 73 25 80 31 33 75 56 59 52 79 41 20 47 56 48 49 20 51 55 50 53 65 43 79 58 75 74 69 30 78 76 31 69 79 68 77 36 31 80 65 36 59 24 69 40 47 29 80 38 74 68 21 78 25 63 73 52 66 77 57 47 73 23 79 69 65 23...
output:
27991 T T P T P T T P P P T T T P T P T P P P P T T P T T P T T P T P T P P T T T P T P P P T P P P P T P P T P T T T T T P T T P T T T T P P T T P T P T P P P T P T T P T P T T P T T T P T P T T T P T P T T T P P T T P P P P T T T P P P P P P T T P P P T P P P P T P P P P T T T P T P P P T P P P T ...
result:
ok All checks passed
Test #34:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
500 229 245 61 44 43 51 34 51 36 66 53 49 53 59 45 36 35 33 38 40 45 42 48 57 44 42 62 52 44 63 44 42 43 60 46 34 64 43 61 49 41 41 64 50 37 65 37 37 33 63 43 59 63 40 49 64 54 43 42 59 59 66 43 53 55 33 44 57 34 53 43 47 55 35 66 61 43 58 49 44 62 49 50 57 50 56 63 40 51 38 38 45 35 64 51 33 58 62 ...
output:
28900 P T T P T P T P P T P P T T T T T T T T T P T T P P T P T T T P T T P T P T T T P T T P T T T P T P P T T P P T T P P P T P P T T P T P T T P T P P T P T T P T P P P P P T P T T T T P P T P P T P T P P T P T T P T P P T P P P P P T T P P P T T P P P T P T T T P P T P P T P T P P P T T P T T P ...
result:
ok All checks passed
Test #35:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
500 53 70 43 39 54 47 75 75 66 36 40 59 80 32 25 45 66 62 43 26 51 41 62 55 70 61 40 25 22 27 25 55 61 50 47 76 35 71 63 37 64 32 78 66 55 37 59 22 25 56 56 34 22 61 42 28 63 58 50 62 65 62 47 51 21 46 65 58 73 69 34 43 77 55 71 32 59 44 32 71 44 28 65 22 22 80 67 38 73 57 53 58 27 61 53 32 71 44 73...
output:
26768 P P T P T T T P P T T P P P T T P P T P T T T T P P P P P T T T P T P T T P T P T T T P T P P T T P P T P P T T T T T T P T P P T T T T P P T T T P T P P T P P T P P T T P T T T T P T T P T P T T P P T P P T P T T T P P P P P P T P T T T T P P P P T T T T P P T P P T T P P P T T P P T T T T P ...
result:
ok All checks passed
Test #36:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
500 245 238 44 66 65 54 63 56 62 66 62 53 48 55 54 55 62 42 66 60 52 54 51 57 41 35 43 60 40 52 46 53 49 49 59 58 50 45 45 45 59 36 61 38 59 34 61 42 48 47 55 37 57 40 62 45 37 44 64 56 37 43 57 37 58 63 60 47 64 40 42 38 56 40 37 33 54 66 51 51 56 54 61 66 52 42 42 45 36 61 54 54 63 60 58 48 33 58 ...
output:
29050 T P P P P P P P P P T P P P P T P P P P P P T T T P T P T P T T P P T T T T P T P T P T P T T T P T P T P T T T P P T T P T P P P T P T T T P T T T P P P P P P P P P T T T T P P P P P P T T P T P T T P T T P P P T P P P P P T P P T T P T T T T P T P T P T P T P P T T T P P P T T T T T T P T T ...
result:
ok All checks passed
Test #37:
score: 0
Accepted
time: 2ms
memory: 3560kb
input:
500 68 59 78 27 59 63 49 32 36 36 36 23 22 21 30 21 33 74 24 26 31 51 20 60 47 42 69 20 74 65 77 74 38 63 39 54 37 28 25 79 58 73 61 53 41 80 27 28 25 66 38 75 32 22 34 70 56 34 21 49 32 41 43 74 64 39 52 39 35 79 22 30 56 63 30 31 53 63 80 46 64 68 77 21 32 42 20 79 55 39 68 43 42 45 31 58 33 78 45...
output:
26565 T P T T T P P P P P P P P P P T P P P T P T T P T P T T T T P T P T P P P T T T T T P T P P P T P T P P P T T P P T P P P T T P T P P T P P T T P P T T T T T T T P P P P T T P T P P P P T P T P P T T T P T T P T P T T T P T T P T P T T T P P P T P P T P P P T T P T T T T T T P T P T T P T T T ...
result:
ok All checks passed
Test #38:
score: -100
Wrong Answer
time: 8ms
memory: 4008kb
input:
200000 33308 0 51 8 85 33 82 19 91 21 98 22 12 23 40 7 74 96 63 47 84 44 11 76 3 13 26 72 45 72 51 100 80 15 2 67 99 94 56 44 5 93 50 49 34 1 20 3 81 40 53 85 33 66 88 43 73 83 94 23 6 65 89 18 87 16 69 69 89 84 50 79 54 25 72 73 40 69 81 20 12 89 33 10 64 84 75 73 8 62 32 11 21 84 83 47 30 78 8 84 ...
output:
4563 P P
result:
wrong output format Unexpected end of file - token expected