#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "debug.h"
#else
#define debug(...)
#endif
#define endl '\n'
using ll = long long ;
// max(0.3*x,x−⌊120*x*t/250*d⌋−50w)
const long long D = 150 ;
long long initial_scores[ ] = { 750 , 1250 , 1500 , 2000 , 2500 , 3000 } ;
long long tourist_times[ ] = { 4 , 13 , 19 , 38 , 65 , 134 } ;
void solve( ) {
for ( int i = 0 ; i < 6 ; i++ ) {
long double x = initial_scores[ i] ;
long double t = tourist_times[ i] ;
int wa = 0 ; // tourist doesn't get WA
long double tourist_score = max( 0.3 * x, x - floor ( 120 * x * t / ( 250 * D) ) - 50 * wa) ;
cout << "In problem " << ( char ) ( 'A' + i) << " tourist's score was " << tourist_score << ", solving it in " << t << " minutes" << endl;
long long L = t + 1 , R = 1e9 ;
long double score_to_lose = tourist_score - 6 ;
long double time_to_lose = 1e9 ;
while ( L <= R) {
long double m = ( L + R) / 2 ;
long double possible_score = max( 0.3 * x, x - floor ( 120 * x * m / ( 250 * D) ) - 50 * wa) ;
if ( possible_score <= score_to_lose) {
time_to_lose = m;
R = m - 1 ;
} else {
L = m + 1 ;
}
}
cout << "If tourist took " << ( time_to_lose - t) << " minutes more, he would have lost the 1st place" << endl;
}
}
int32_t main( ) {
cin .tie ( 0 ) - > sync_with_stdio( 0 ) ;
solve( ) ;
/* cout << solve() << endl; */
/* cout << (solve() ? "Yes" : "No") << endl; */
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojaWZkZWYgTE9DQUxfREVCVUcKI2luY2x1ZGUgImRlYnVnLmgiCiNlbHNlCiNkZWZpbmUgZGVidWcoLi4uKQojZW5kaWYKI2RlZmluZSBlbmRsICdcbicKdXNpbmcgbGwgPSBsb25nIGxvbmc7CgovLyBtYXgoMC4zKngseOKIkuKMijEyMCp4KnQvMjUwKmTijIviiJI1MHcpCgpjb25zdCBsb25nIGxvbmcgRCA9IDE1MDs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kgLSA1MCAqIHdhKTsKICAgICAgICAgICAgaWYgKHBvc3NpYmxlX3Njb3JlIDw9IHNjb3JlX3RvX2xvc2UpIHsKICAgICAgICAgICAgICAgIHRpbWVfdG9fbG9zZSA9IG07CiAgICAgICAgICAgICAgICBSID0gbSAtIDE7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBMID0gbSArIDE7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY291dCA8PCAiSWYgdG91cmlzdCB0b29rICIgPDwgKHRpbWVfdG9fbG9zZSAtIHQpIDw8ICIgbWludXRlcyBtb3JlLCBoZSB3b3VsZCBoYXZlIGxvc3QgdGhlIDFzdCBwbGFjZSIgPDwgZW5kbDsKICAgIH0KfQoKaW50MzJfdCBtYWluKCkgewogICAgY2luLnRpZSgwKS0+c3luY193aXRoX3N0ZGlvKDApOwogICAgc29sdmUoKTsKICAgIC8qIGNvdXQgPDwgc29sdmUoKSA8PCBlbmRsOyAqLwogICAgLyogY291dCA8PCAoc29sdmUoKSA/ICJZZXMiIDogIk5vIikgPDwgZW5kbDsgKi8KfQo=
stdout
In problem A tourist's score was 741, solving it in 4 minutes
If tourist took 3 minutes more, he would have lost the 1st place
In problem B tourist's score was 1198, solving it in 13 minutes
If tourist took 2 minutes more, he would have lost the 1st place
In problem C tourist's score was 1409, solving it in 19 minutes
If tourist took 2 minutes more, he would have lost the 1st place
In problem D tourist's score was 1757, solving it in 38 minutes
If tourist took 1 minutes more, he would have lost the 1st place
In problem E tourist's score was 1980, solving it in 65 minutes
If tourist took 1 minutes more, he would have lost the 1st place
In problem F tourist's score was 1714, solving it in 134 minutes
If tourist took 1 minutes more, he would have lost the 1st place