/** https://youtu.be/qbsvZclUXh8 https://youtu.be/2DaRhiCKGMk https://youtu.be/X9so0kW2U0U https://youtu.be/dQw4w9WgXcQ */ #include #define endl '\n' using namespace std; int n,a,b,m,d,h; string text; int price[28]; int used_letter[28]; int pos[28]; int letter[28]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); freopen("printing.in", "r", stdin); freopen("printing.out", "w", stdout); cin>>n; cin>>text; for(int i=0; i>a>>b>>m>>d>>h; for(int i=1; i<=27; i++) { cin>>price[i]; } pos[1] = (text[0]-'a'+1); letter[ (text[0]-'a'+1) ] = 1; int idx = 2; for(int i=1; i<=27; i++) { if( (text[0]-'a'+1) != i) { pos[idx] = i; letter[i] = idx; idx++; } } int active = 1; vector< pair > procedure; for(int i=0; i > ans; ans.push_back(procedure[0]); for(int i=1; i