QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#94692#5608. Determining Nucleotide AssortmentsPetroTarnavskyi#WA 0ms3352kbC++171.4kb2023-04-07 15:28:082023-04-07 15:28:10

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-07 15:28:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3352kb
  • [2023-04-07 15:28:08]
  • 提交

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 == 'T')  {
				j = 9;
			}
			else if (c == 'J') {
				j = 10;
			}
			else if (c == 'Q') {
				j = 11;
			}
			else if (c == 'K') {
				j = 12;
			}
		}
		assert(j != -1);
		cnt[j]++;
	}
	vector<LL> dp(16);
	dp[0] = 1;
	for (int ai : a) {
		RFOR(j, 16 - ai, 0) {
			dp[j + ai] += dp[j];
		}
	}
	LL 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 *= cnt[i];
		}
		else {
			if (len >= 3) {
				ans += prod;
			}
			len = 0;
			prod = 1;
		}
	}
	if (len >= 3) {
		ans += prod;
	}
	cout << ans << "\n";
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3352kb

input:

TATATGCTCT
3
1 10
6 10
6 6

output:

0

result:

wrong answer 1st lines differ - expected: 'TACG', found: '0'