Submission #1009097

# Submission time Handle Problem Language Result Execution time Memory
1009097 2024-06-27T08:44:31 Z bornag Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
309 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double

ll lx, ly, gx, gy;
string cmd, s;

unordered_map<string, bool> vs;

ll k;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cout << fixed << setprecision(12);
	
	cin >> k >> s;
	
	cin >> lx >> ly >> gx >> gy;
		
	ld mxi = -1;
	ld mni = LLONG_MAX;
	
	ld 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++){
			if(vs[to_string(gx) + '-' + to_string(gy) + '-' + to_string(j)]){
				cout << mni << ' ' << mxi << '\n';
				return 0;
			}
			
			vs[to_string(gx) + '-' + to_string(gy) + '-' + to_string(j)] = true;
			
			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

expgorl.cpp: In function 'int main()':
expgorl.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for(int j = 0; j < s.size(); j++){
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 309 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -