Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Contest : CF GYM
- */
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int LL;
- #define inp_s ios_base::sync_with_stdio(false);cin.tie(0)
- #define DRT() int test_case;cin>>test_case;while(test_case--)
- #define VI vector<int>
- #define VS vector<string>
- #define VLL vector<LL>
- #define PII pair<int,int>
- #define all(c) c.begin(),c.end()
- #define sz(c) c.size()
- #define clr(c) c.clear()
- #define pb push_back
- #define mp make_pair
- #define GI(x) scanf("%d",&x)
- #define endn "\n"
- #define FOR(i,a,b) for(int i=a;i<b;i++)
- #define RFOR(i,a,b) for(int i=b-1;i>=a;i--)
- #define gcd(a,b) __gcd(a,b)
- #define MOD 1000000007
- #define EPS 1E-10
- #define PI acos(-1)
- #define CASE(x) cout << "Case #" << x << ": ";
- int poss(string a,string b)
- {
- FOR(i,0,sz(a))
- {
- if(a[i] == b[i]) continue;
- if(a[i] != '?') return 0;
- }
- return 1;
- }
- int main()
- {
- inp_s;
- int n;
- cin >> n;
- string id;
- cin >> id;
- int ans = 0;
- vector< pair<string,int> > arr(n);
- FOR(i,0,n)
- {
- cin >> arr[i].first >> arr[i].second;
- if(arr[i].first == id)
- {
- cout << arr[i].second << endl;
- return 0;
- }
- if(poss(arr[i].first , id)) ans = max(ans , arr[i].second);
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement