Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define sc(a) scanf("%d", &a)
- #define sc2(a, b) scanf("%d%d", &a, &b)
- #define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
- #define scs(a) scanf("%s", a)
- #define pri(x) printf("%d\n", x)
- #define prie(x) printf("%d ", x)
- #define pris() printf("\n")
- #define fi first
- #define se second
- #define mp make_pair
- #define pb push_back
- #define BUFF ios::sync_with_stdio(false)
- #define db(x) cerr << #x << " == " << x << endl
- #define power(a,x) __gnu_cxx::power(a, x)
- #define eps 1e-5
- typedef long long int ll;
- typedef long double ld;
- typedef pair<int, int> ii;
- typedef vector<int> vi;
- typedef vector<vector<int> > vvi;
- typedef vector<ii> vii;
- const int INF = 0x3f3f3f3f;
- const ll LINF = 0x3f3f3f3f3f3f3f3fll;
- const ld pi = acos(-1);
- const int MOD = 1e9 + 7;
- map<string,double> dp;
- int main()
- {
- BUFF;
- int n;
- cin>>n;
- dp["pink"]=1;
- while(n--)
- {
- string a,b;
- cin>>a>>b;
- double x;
- cin>>x;
- if(dp.count(a)){
- double y = 0;
- if(dp.count(b) ) y = log(dp[b]);
- dp[a]=min(max(log2(dp[a]),log2(y)+log2(x)),(double)INF);
- }else{
- dp[a] = log2(x);
- }
- }
- cout<<setprecision(15)<<fixed;
- dp["blue"]=min((double)10,pow(dp["blue"], 2) );
- cout<<dp["blue"]<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement