Submission #4769

# Submission time Handle Problem Language Result Execution time Memory
4769 2014-01-01T09:40:50 Z gs13068 Experiments with Gorlum (IZhO13_expgorl) C++
40 / 100
1000 ms 1188 KB
#include<cstdio>
#include<cmath>
#include<cstring>

char str[10002];
int x[10000];
int y[10000];

int main()
{
	int a,b,c,d;
	int i,j,n,k;
	long double min=1.0E6,max=0.0,temp;
	scanf("%d%s%d%d%d%d",&k,str+1,&a,&b,&c,&d);
	n=strlen(str+1);
	x[0]=c-a;
	y[0]=d-b;
	for(i=1;i<=n;i++)
	{
		x[i]=x[i-1];
		y[i]=y[i-1];
		switch(str[i])
		{
		case 'L':
			x[i]--;
			break;
		case 'R':
			x[i]++;
			break;
		case 'F':
			y[i]++;
			break;
		case 'B':
			y[i]--;
			break;
		}
	}
	for(i=0;i<=n;i++)
	{
		for(j=0;j<k;j++)
		{
			temp=sqrtl(1LL*(x[i]+j*(x[n]-x[0]))*(x[i]+j*(x[n]-x[0]))+1LL*(y[i]+j*(y[n]-y[0]))*(y[i]+j*(y[n]-y[0])));
			if(temp<min)min=temp;
			if(temp>max)max=temp;
		}
	}
	printf("%.20Lf %.20Lf",min,max);
}
# Verdict Execution time Memory Grader output
1 Correct 224 ms 1188 KB Output is correct
2 Correct 292 ms 1188 KB Output is correct
3 Correct 324 ms 1188 KB Output is correct
4 Correct 340 ms 1188 KB Output is correct
5 Correct 180 ms 1188 KB Output is correct
6 Correct 272 ms 1188 KB Output is correct
7 Correct 288 ms 1188 KB Output is correct
8 Correct 396 ms 1188 KB Output is correct
9 Execution timed out 1000 ms 1184 KB Program timed out
10 Execution timed out 1000 ms 1184 KB Program timed out
11 Execution timed out 1000 ms 1184 KB Program timed out
12 Execution timed out 1000 ms 1184 KB Program timed out
13 Execution timed out 1000 ms 1184 KB Program timed out
14 Execution timed out 1000 ms 1184 KB Program timed out
15 Execution timed out 1000 ms 1184 KB Program timed out
16 Execution timed out 1000 ms 1184 KB Program timed out
17 Execution timed out 1000 ms 1184 KB Program timed out
18 Execution timed out 1000 ms 1184 KB Program timed out
19 Execution timed out 1000 ms 1184 KB Program timed out
20 Execution timed out 1000 ms 1184 KB Program timed out