Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <bits/stdc++.h>using namespace std;using LL = int64_t;const LL INF = 0x3f3f3f3f;const LL mod = 1e9 + 7;int main() {ios::sync_with_stdio(0);cin.tie(0);int n;cin >> n;vector<string> a(n);vector<int> val(26);for (auto& i : a) {cin >> i;for (auto j : i) if (isupper(j)) val[j - 'A'] = 1;i += '<';}int num = accumulate(val.begin(), val.end(), 0);int t;cin >> t;while (t--) {for (int i = 0; i < num; i++) {char c;int v;cin >> c >> v;val[c - 'A'] = v;}int ans = 1;for (auto& i : a) {int flag = -1;