QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687205#6466. ConcertsPetroTarnavskyi#Compile Error//C++231.1kb2024-10-29 17:36:222024-10-29 17:36:22

Judging History

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

  • [2024-10-29 17:36:22]
  • 评测
  • [2024-10-29 17:36:22]
  • 提交

answer

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

#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--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;

const int N = 1e5 + 1;
const int K = 3e2 + 1;
const int mod = 1e9 + 7;

void updAdd(int& a, int b)
{
	a += b;
	if(a >= mod)
		a -= mod;
}


int dp[N][K];



int main()
{
	ios::sync_with_stdio(0); 
	cin.tie(0);
	
	int k, n;
	cin >> k >> n;
	
	
	VI h(26);
	FOR(i, 0, 26)
		cin >> h[i];
	
	string s, t;
	cin >> s >> t;
	
	if(n >= N || k >= K)
		exit(0);
	if(n != SZ(t) || k != SZ(s))
		exit(0);
	
	
	dp[0] = 1;
	FOR(i, 0, n)
	{
		FOR(j, 0, k + 1)
		{
			if(j != k && t[i] == s[j])
				updAdd(dp[min(n, i + 1 + h[t[i] - 'A'])][j + 1], dp[i][j]);
			updAdd(dp[(i + 1)][j], dp[i][j]);
		}
	}
	cout << dp[n][k] << "\n";
	
	
	
	

	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:58:15: error: incompatible types in assignment of ‘int’ to ‘int [301]’
   58 |         dp[0] = 1;
      |         ~~~~~~^~~