Submission #17507

#TimeUsernameProblemLanguageResultExecution timeMemory
17507azecoderExperiments with Gorlum (IZhO13_expgorl)C++98
0 / 100
19 ms2152 KiB
#include <iostream> #include <iomanip> #include <math.h> #include <vector> #define MAXN 100005 #define intt long long #define f first #define s second using namespace std ; intt k , t[100] ; long double sx , sy , gx , gy , fx , fy , mn , mx ; vector < pair < long double , long double > > d ; string a ; int main () { cin >> k ; cin >> a ; cin >> sx >> sy >> gx >> gy ; long double x = gx , y = gy ; d.push_back ( make_pair ( x , y ) ) ; for ( int i = 0 ; i < a.size () ; i ++ ) { if ( a[i] == 'I' ) continue ; if ( a[i] == 'L' ) x -- ; if ( a[i] == 'R' ) x ++ ; if ( a[i] == 'F' ) y ++ ; if ( a[i] == 'B' ) y -- ; d.push_back ( make_pair ( x , y ) ) ; } fx = x - gx ; fy = y - gy ; for ( int i = 0 ; i < d.size () ; i ++ ) { x = d[i].f ; y = d[i].s ; long double prev = sqrt ( ( sx - x ) * ( sx - x ) + ( sy - y ) * ( sy - y ) ) , now ; intt z = k ; mn = min ( mn , prev ) ; do { prev = now ; x += fx ; y += fy ; now = sqrt ( ( sx - x ) * ( sx - x ) + ( sy - y ) * ( sy - y ) ) ; mn = min ( mn , now ) ; mx = max ( mx , now ) ; }while ( prev > now and z -- ) ; } for ( int i = 0 ; i < d.size () ; i ++ ) { x = d[i].f ; y = d[i].s ; x += k * fx ; y += k * fy ; long double h = sqrt ( ( sx - x ) * ( sx - x ) + ( sy - y ) * ( sy - y ) ) ; mx = max ( mx , h ) ; } cout << fixed << setprecision ( 9 ) ; cout << mn << " " << mx << endl ; return 0 ; }
#Verdict Execution timeMemoryGrader output
Fetching results...