Submission #1009078

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

#define ll long long
#define ld long double

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

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;
	for(int i = 0; i < k; i++){
		for(auto c : s){
			ld di = sqrt(abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly));
			mxi = max(mxi, di);
			mni = min(mni, di);
		
			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';
}
# Verdict Execution time Memory Grader output
1 Correct 201 ms 344 KB Output is correct
2 Correct 265 ms 348 KB Output is correct
3 Correct 283 ms 348 KB Output is correct
4 Correct 313 ms 428 KB Output is correct
5 Correct 156 ms 344 KB Output is correct
6 Correct 233 ms 344 KB Output is correct
7 Correct 273 ms 348 KB Output is correct
8 Correct 350 ms 348 KB Output is correct
9 Execution timed out 1062 ms 348 KB Time limit exceeded
10 Halted 0 ms 0 KB -