搜索小练#7

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <cstdio>
using namespace std;

const int N = 1e4+66, INF = 250;

int T, res, len;
int a, b, i, dy;
char p[N], t[N], s[N], f[N];

int main () {
scanf ("%d", &T);
while (T --> 0) {
++ i; res = a = b = 0;
cin >> len;
scanf ("%s%s", p+1, t+1);
scanf ("%s", s+1);
while (1) {
dy = a = b = 0;
if (res == INF) {res = -1; break;}
for (int i = 1; i <= (len<<1); ++ i)
f[i] = (i&1 == 1) ? t[++a] : p[++b];
// cout << "-->";
// for (int i = 1; i <= (len<<1); ++ i)
// cout<<f[i];
// cout << '\n';
++ res;
for (int i = 1; i <= (len<<1); ++ i)
if (f[i] == s[i])
++ dy;
if (dy == (len<<1)) break;
for (int i = 1; i <= len; ++ i)
p[i] = f[i], t[i] = f[len+i];
}
cout << i << ' ' << res << '\n';
}
}

感觉做这个题真tm拉低我智商

这么水的数据

INF等于250 随便跑一跑就能水过“-1”

搜索个屁啊

就是个破模拟

不需要动一点脑子

花了我一个小时.....

垃圾题