???
我想整个自动机。
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e4 + 10;
class AM {
public:
pair<int, int> e[5];
pair<int, int>& operator[](const size_t& __n) {
return e[__n];
}
const pair<int, int>& operator[](const size_t& __n) const {
return e[__n];
}
AM& operator*=(const AM& __rhs) {
for(int i = 0; i < 5; i++) {
e[i].second += __rhs[e[i].first].second;
e[i].first = __rhs[e[i].first].first;
}
return *this;
}
AM operator * (const AM& __rhs) {
return AM(*this) *= __rhs;
}
};
#define _e 0
#define _0 1
#define _00 2
#define _01 3
#define _001 4
#define MP make_pair
const AM A[2] = {
{MP(_0, -1), MP(_00, -1), MP(_0, 1), MP(_0, -1), MP(_00, -1)},
{MP(_e, 1), MP(_01, 1), MP(_001, 1), MP(_e, 1), MP(_e, 1)}
};
int main() {
cerr << A[0][1].first << ' ' << A[1][2].second;
}
这样为啥是对的:
const AM A[2] = { {MP(_0, -1), MP(_00, -1), MP(_0, 1), MP(_0, -1), MP(_00, -1)}, {MP(_e, 1), MP(_01, 1), MP(_001, 1), MP(_e, 1), MP(_e, 1)} };