#include #include using namespace std; constexpr int inf = 987654321; int main(void) { int n, p; scanf("%d%d", &n, &p); vector> mat(4, vector(n)); // mat[4][n] for(int i=0; i> dp(2, vector(p+1, inf)); // dp[2][p+1] dp[0][0] = 0; for(int i=0; i