1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| #pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include<bits/stdc++.h>
using namespace std;
template<class T> long long Mod(T a,T b){return ((a%b)+b)%b;}
#define endl '\n'
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0);
#define GETOUT cout.tie(0);
#define gc getchar()
#define cendl cout << endl;
#define fr(bob,n,l) for(int bob=n;bob<l;bob++)
#define frc(bot,n,l) for(int bot=n;bot<=l;bot++)
#define frx(i,n,l) for(int i=n;i<l;i++)
#define mem(arr,initn) memset(arr,initn,sizeof(arr))
//#define int long long
const int MAX=1e9+7;
const int MOD=998244353;
string s1,s2,s3,s4,s5;
vector<string> six;
int rewards[]={0,40000,10000,4000,1000};
int ans=0;
inline void solve(string s){
frc(i,1,5){
string ts(s.begin()+i,s.end());
string ta(s3.begin()+i,s3.end());
string tb(s4.begin()+i,s4.end());
string tc(s5.begin()+i,s5.end());
if((ts==ta||ts==tb||ts==tc) &&i<5 ){
ans+=rewards[i];
break;
}
else if(i==5){
for(auto j:six){
if(ts==j){
ans+=200;
return;
}
}
}
}
}
signed main(){
IO;
GETOUT;
cin >> s1 >> s2 >> s3 >> s4 >> s5;
string a(s3.begin()+5,s3.end());
string b(s4.begin()+5,s4.end());
string c(s5.begin()+5,s5.end());
six.push_back(a);six.push_back(b);six.push_back(c);
while(1){
string s;
cin >> s;
if(s.size()==3) six.push_back(s);
if(s.size()==8){
if(s==s1) ans+=10000000;
else if(s==s2) ans+=2000000;
else if(s==s3||s==s4||s==s5) ans+=200000;
else solve(s);
}
if(s=="0") break;
}
cerr << ans << endl;
return 0;
}
|