Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. /*
  2. Contest : CF GYM
  3. */
  4.  
  5. #include<bits/stdc++.h>
  6. using namespace std;
  7.  
  8. typedef long long int LL;
  9.  
  10. #define inp_s ios_base::sync_with_stdio(false);cin.tie(0)
  11. #define DRT() int test_case;cin>>test_case;while(test_case--)
  12.  
  13. #define VI vector<int>
  14. #define VS vector<string>
  15. #define VLL vector<LL>
  16. #define PII pair<int,int>
  17.  
  18. #define all(c) c.begin(),c.end()
  19. #define sz(c) c.size()
  20. #define clr(c) c.clear()
  21. #define pb push_back
  22. #define mp make_pair
  23.  
  24. #define GI(x) scanf("%d",&x)
  25. #define endn "\n"
  26.  
  27. #define FOR(i,a,b) for(int i=a;i<b;i++)
  28. #define RFOR(i,a,b) for(int i=b-1;i>=a;i--)
  29.  
  30. #define gcd(a,b) __gcd(a,b)
  31. #define MOD 1000000007
  32. #define EPS 1E-10
  33. #define PI acos(-1)
  34.  
  35. #define CASE(x) cout << "Case #" << x << ": ";
  36.  
  37. int poss(string a,string b)
  38. {
  39. FOR(i,0,sz(a))
  40. {
  41. if(a[i] == b[i]) continue;
  42. if(a[i] != '?') return 0;
  43. }
  44. return 1;
  45. }
  46.  
  47. int main()
  48. {
  49. inp_s;
  50. int n;
  51. cin >> n;
  52. string id;
  53. cin >> id;
  54. int ans = 0;
  55. vector< pair<string,int> > arr(n);
  56. FOR(i,0,n)
  57. {
  58. cin >> arr[i].first >> arr[i].second;
  59. if(arr[i].first == id)
  60. {
  61. cout << arr[i].second << endl;
  62. return 0;
  63. }
  64. if(poss(arr[i].first , id)) ans = max(ans , arr[i].second);
  65. }
  66. cout << ans << endl;
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement