QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#94687 | #5608. Determining Nucleotide Assortments | PetroTarnavskyi# | WA | 2ms | 3388kb | C++17 | 1.3kb | 2023-04-07 15:21:54 | 2023-04-07 15:21:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> cnt(13);
vector<int> a(n);
FOR(i, 0, n) {
char c;
cin >> c;
assert(isalpha(c) || isdigit(c));
int j = -1;
if (c == 'A') {
a[i] = 1;
j = 0;
}
else if(isdigit(c)) {
a[i] = c - '0';
j = c - '0' - 1;
}
else {
a[i] = 10;
if (c == 'J') {
j = 10;
}
else if (c == 'Q') {
j = 11;
}
else if (c == 'K') {
j = 12;
}
}
assert(j != -1);
cnt[j]++;
}
vector<int> dp(16);
dp[0] = 1;
for (int ai : a) {
RFOR(j, 16 - ai, 0) {
dp[j + ai] += dp[j];
}
}
int ans = 2 * dp[15];
int len = 0, prod = 1;
FOR(i, 0, 13) {
if (cnt[i] > 0) {
ans += cnt[i] * (cnt[i] - 1);
len++;
prod = 1;
}
else {
if (len >= 3) {
ans += prod;
}
len = 0;
}
}
if (len >= 3) {
ans += prod;
}
cout << ans << "\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3388kb
input:
TATATGCTCT 3 1 10 6 10 6 6
output:
0
result:
wrong answer 1st lines differ - expected: 'TACG', found: '0'