QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687146#6466. ConcertsLaVuna47#WA 1ms3804kbC++201.4kb2024-10-29 17:25:042024-10-29 17:25:04

Judging History

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

  • [2024-10-29 17:25:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3804kb
  • [2024-10-29 17:25:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<db, db> pdd;

#ifdef ONPC
mt19937 rnd(228);
#endif

#define AL_SZ 26
const ll MOD = 1e9+7;
ll H[AL_SZ];

string S, T;

vector<vector<ll>> dp;

ll f(int i, int j)
{
	if(i == sz(S))
		return 1;
	if(j == sz(T))
		return 0;
	if(dp[i][j] != -1)
		return dp[i][j];
	ll res = 0;
	res += f(i, j+1);
	if(S[i] == T[j])
	{
		res += f(i+1, j+1+H[T[j]-'A']);
	}
	res %= MOD;
	return dp[i][j] = res;
}

int solve()
{
	ll k, n;
	if(!(cin >> n >> k))
		return 1;
	FOR(i,0,AL_SZ) cin >> H[i];
	cin >> S >> T;
	dp = vector<vector<ll>>(sz(S)+4, vector<ll>(sz(T)+7, -1));
	cout << f(0,0) << '\n';
	return 0;	
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int TET = 1e9;
	//cin >> TET;
	for (int i = 1; i <= TET; i++)
	{
		if (solve())
			break;
			
		#ifdef ONPC
			cerr << "_________________________________\n";
		#endif
	}
	#ifdef ONPC
		cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
	#endif
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3804kb

input:

20 1000
3 8 6 7 7 2 3 0 9 0 3 6 3 5 2 4 5 5 2 6 7 0 9 5 0 1
JWNOUXSQLCNEPZIATFRG
VBNTLXRPBHYNSDNNUDOLFJWPHOZVJWERGFCGRQDSOHPSSYXKBLEHYVXOCZHQPIZFQVFEDZJFQPWJOZXYUNWGOBLGHCGDAWTLNPVOHESQFLSIYYSFBRPLCRAVRGTKGTATWBBMRWWHPIYEKYZJSTLZNJAOENGENYCWJSBTZNSVBTJUWHBVRWJXURHVNJCMBQKDGJPURYCDBKESUGJUULYBQTXBOBN...

output:

802819578

result:

wrong answer 1st lines differ - expected: '324855496', found: '802819578'