#include #include #include using namespace std; int main() { // Get input int N; scanf("%d\n", &N); std::vector< int > values (N); std::vector< char > suits (N); scanf("%c%d", &suits[0], &values[0]); for(int i = 1; i < N; i++) { scanf(" %c%d", &suits[i], &values[i]); } // Go over all valid suit permutations int best_lis = 0; vector< char > suit_order {'E', 'R', 'S', 'W', 'C'}; do { // Translate the hand to integers with the same relative order vector< int > hand (N); for (int i=0; i lis_aux (hand.size() + 1, SUPERIOR); // position i will contain the smallest value that ends an increasing subsequence of length i+1 (or SUPERIOR if no such sequence exists) for (auto i=hand.begin(); i