Submission #1009127

#TimeUsernameProblemLanguageResultExecution timeMemory
1009127bornagExperiments with Gorlum (IZhO13_expgorl)C++14
0 / 100
1061 ms432 KiB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
 
ll lx, ly, gx, gy;
string s, si;
 
ll k;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cout << fixed << setprecision(12);
	
	cin >> k >> si;
	
	for(int i = 0; i < si.size(); i++){
		if(si[i] != 'I') s+=si[i];
	}
	
	cin >> lx >> ly >> gx >> gy;
		
	double mxi = -1;
	double mni = LLONG_MAX;
	
	double di = sqrt(abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly));
	mxi = max(mxi, di);
	mni = min(mni, di);
	
	for(int i = 0; i < k; i++){
		for(int j = 0; j < s.size(); j++){
			char c = s[j];
		
			if(c == 'L') gx--;
			else if(c == 'R') gx++;
			else if(c == 'F') gy++;
			else if(c == 'B') gy--;
		
			di = sqrt(abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly));
			mxi = max(mxi, di);
			mni = min(mni, di);
		}
	}
	
	cout << mni << ' ' << mxi << '\n';
}

Compilation message (stderr)

expgorl.cpp: In function 'int main()':
expgorl.cpp:20:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for(int i = 0; i < si.size(); i++){
      |                 ~~^~~~~~~~~~~
expgorl.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(int j = 0; j < s.size(); j++){
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...