QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#440568#7262. String ModificationI_Love_Sonechka#WA 0ms52304kbC++171.4kb2024-06-13 20:45:062024-06-13 20:45:21

Judging History

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

  • [2024-06-13 20:45:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:52304kb
  • [2024-06-13 20:45:06]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

// c++ short types
#define vt vector
//typedef long long ll;
typedef long double ld;

void whattime() { cout << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; }
const int inf = 1e9;
const int mod = 998244353;
bool debug = false;
const ld eps = 1e-9;

mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 5010;
bitset<maxn*maxn*2> dp;

void solve() {
	dp.set(0);
	cout << dp << "\n";
	string s, t; cin >> s >> t;
	int n = int(s.size()), m = int(t.size());
	s = 'x' + s;
	t = 'x' + t;
	auto get_id = [&](int x, int y, int k) {
		return k * maxn * maxn + x * maxn + y;
	};
//	vt<vt<vt<bool>>> dp(n+2, vt<vt<bool>>(m+2, vt<bool>(2, false)));
	dp[get_id(1,1,0)] = s[1] == t[1];
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			for(int k = 0; k < 2; ++k) {
				dp[get_id(i+1,j+1,0)] = dp[get_id(i+1,j+1,0)] || (dp[get_id(i, j, k)] && s[i+1] == t[j+1]);
				dp[get_id(i,j+1,1)] = dp[get_id(i,j+1,1)] || dp[get_id(i,j,k)] && (k==1 || s[i] != t[j+1]);
			}
		}
	}
	cout << (dp[get_id(n,m,0)] || dp[get_id(n,m,1)] ? "Yes" : "No") << "\n";
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int tt = 1;
	if(debug) {
		tt = 1e5;
	} else {
//		cin >> tt;
	}
	for(int t = 0; t < tt; ++t) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

snuke
snukent

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

wrong output format Length of token exceeds 33554432, token is '000000000000000000000000000000...0000000000000000000000000000000...'