Submission #17507

# Submission time Handle Problem Language Result Execution time Memory
17507 2015-12-22T13:27:37 Z azecoder Experiments with Gorlum (IZhO13_expgorl) C++
0 / 100
19 ms 2152 KB
#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 time Memory Grader output
1 Incorrect 0 ms 1748 KB Output isn't correct
2 Incorrect 2 ms 1880 KB Output isn't correct
3 Incorrect 0 ms 1880 KB Output isn't correct
4 Incorrect 0 ms 1880 KB Output isn't correct
5 Incorrect 3 ms 1748 KB Output isn't correct
6 Incorrect 2 ms 1880 KB Output isn't correct
7 Incorrect 1 ms 1880 KB Output isn't correct
8 Incorrect 2 ms 1880 KB Output isn't correct
9 Incorrect 0 ms 2140 KB Output isn't correct
10 Incorrect 5 ms 2152 KB Output isn't correct
11 Incorrect 1 ms 2140 KB Output isn't correct
12 Incorrect 7 ms 2152 KB Output isn't correct
13 Incorrect 11 ms 2152 KB Output isn't correct
14 Incorrect 9 ms 2140 KB Output isn't correct
15 Incorrect 19 ms 2140 KB Output isn't correct
16 Incorrect 0 ms 2152 KB Output isn't correct
17 Incorrect 2 ms 2152 KB Output isn't correct
18 Incorrect 0 ms 2152 KB Output isn't correct
19 Incorrect 2 ms 2152 KB Output isn't correct
20 Incorrect 16 ms 2152 KB Output isn't correct