Submission #84429

# Submission time Handle Problem Language Result Execution time Memory
84429 2018-11-15T07:38:38 Z farukkastamonuda Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
1000 ms 632 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
lo int k,lx,ly,gx,gy;
char s[li];
double mx,mn=inf;
double dis(lo int a,lo int b){
	double aa=a,bb=b;
	double cc=lx,dd=ly;
	return sqrt(abs(aa-cc)*abs(aa-cc)+abs(bb-dd)*abs(bb-dd));
}
int main(){
	scanf("%lld",&k);
	scanf("%s",s+1);
	lo int t=strlen(s+1);
	scanf("%lld %lld %lld %lld",&lx,&ly,&gx,&gy);
	mx=max(mx,dis(gx,gy));
	mn=min(mn,dis(gx,gy));
	for(int i=1;i<=k;i++){
		for(int j=1;j<=t;j++){
			if(s[j]=='L'){
				gx--;
			}
			if(s[j]=='R'){
				gx++;
			}
			if(s[j]=='F'){
				gy++;
			}
			if(s[j]=='B'){
				gy--;
			}
			mx=max(mx,dis(gx,gy));
			mn=min(mn,dis(gx,gy));
		}
	}
	printf("%.12lf %.12lf\n",mn,mx);
	return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&k);
  ~~~~~^~~~~~~~~~~
expgorl.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
  ~~~~~^~~~~~~~~~
expgorl.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld %lld",&lx,&ly,&gx,&gy);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 238 ms 376 KB Output is correct
2 Correct 341 ms 512 KB Output is correct
3 Correct 381 ms 512 KB Output is correct
4 Correct 413 ms 512 KB Output is correct
5 Correct 187 ms 512 KB Output is correct
6 Correct 287 ms 512 KB Output is correct
7 Correct 351 ms 512 KB Output is correct
8 Correct 480 ms 632 KB Output is correct
9 Execution timed out 1068 ms 632 KB Time limit exceeded
10 Halted 0 ms 0 KB -