Submission #84439

# Submission time Handle Problem Language Result Execution time Memory
84439 2018-11-15T07:50:24 Z talip Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
1000 ms 736 KB
#include <bits/stdc++.h>
using namespace std;
//Yeter calis artik
//Scanf hurmetine. Pls.
char s[10002];
int x[10001]; int y[10001];
 
int main(){
	int lax, lay, gox, goy, n, k;
	long double mini=1.0E7, maxi=0, ans;
	scanf("%d %s %d %d %d %d",&k,s+1,&lax,&lay,&gox,&goy);	n=strlen(s+1);
	x[0]=gox-lax;	y[0]=goy-lay;
	for(int i=1;i<=n;i++){
		x[i]=x[i-1];		y[i]=y[i-1];
      	if(s[i]=='I'){
          continue;
        }
      	if(s[i]=='L'){
          	x[i]--;	continue;
        }
      	if(s[i]=='R'){
        	x[i]++;	continue;
      	}
      	if(s[i]=='B'){
        	y[i]--;	continue;
      	}
      	if(s[i]=='F'){
        	y[i]++;	continue;
      	}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<k;j++){
			ans=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(mini>ans){
              	mini=ans;
            }
			if(ans>maxi){
              	maxi=ans;
            }
		}
	}
	printf("%.14Lf %.14Lf", mini, maxi);
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %s %d %d %d %d",&k,s+1,&lax,&lay,&gox,&goy); n=strlen(s+1);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 176 ms 376 KB Output is correct
2 Correct 223 ms 380 KB Output is correct
3 Correct 250 ms 484 KB Output is correct
4 Correct 279 ms 596 KB Output is correct
5 Correct 144 ms 596 KB Output is correct
6 Correct 207 ms 672 KB Output is correct
7 Correct 234 ms 672 KB Output is correct
8 Correct 303 ms 736 KB Output is correct
9 Execution timed out 1083 ms 736 KB Time limit exceeded
10 Halted 0 ms 0 KB -