QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60118 | #1901. Third Group Exam | abdelrahman001# | WA | 2ms | 3740kb | C++20 | 1.0kb | 2022-11-02 22:37:58 | 2022-11-02 22:38:01 |
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++) {
if(x[i] > y[i]) {
c[i] = 'T';
ans += x[i];
} else {
c[i] = 'P';
ans += y[i];
}
}
cout << ans << '\n';
for(int i = 0;i < n;i++)
cout << c[i] << " ";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3684kb
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: 1ms
memory: 3576kb
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: 2ms
memory: 3740kb
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: 0ms
memory: 3612kb
input:
1 0 0 92 91
output:
92 T
result:
ok All checks passed
Test #6:
score: -100
Wrong Answer
time: 2ms
memory: 3660kb
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:
824
result:
wrong answer Token element choice[1] equals to "