답안 #634927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634927 2022-08-25T09:03:53 Z pragmatist 생물 실험 (IZhO13_expgorl) C++17
0 / 100
139 ms 65536 KB
#include<bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define x first
#define y second
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define ld long double
#define int long long
#define nl "\n"

using namespace std;
using pii = pair<int, int>;
 
const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
const int MOD = (int)1e9 + 7;
const int M = (int)5e4 + 7; 

int k, Lx, Ly, Gx, Gy;
string a;

int dist(int x1, int y1, int x2, int y2) {
	return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

void solve() {
	cin >> k >> a >> Lx >> Ly >> Gx >> Gy;
	string s;
	while(k--) {
		s += a;
	}
	int mn = inf, mx = -inf;
	mn = min(mn, dist(Gx, Gy, Lx, Ly));
	mx = max(mx, dist(Gx, Gy, Lx, Ly));
	for(auto x : s) {
		if(x == 'L') Gx--;
		if(x == 'R') Gx++;
		if(x == 'F') Gy++;
		if(x == 'B') Gy--;
		mn = min(mn, dist(Gx, Gy, Lx, Ly));
		mx = max(mx, dist(Gx, Gy, Lx, Ly));
	}
	cout << fixed << setprecision(9) << sqrt(mn) << ' ' << sqrt(mx) << nl;
}
 
signed main() {
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	int test = 1;
	//cin >> test;
	while(test--) {
		solve();
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 33840 KB Output is correct
2 Correct 101 ms 26032 KB Output is correct
3 Correct 106 ms 29536 KB Output is correct
4 Correct 120 ms 30996 KB Output is correct
5 Correct 53 ms 19276 KB Output is correct
6 Correct 87 ms 43544 KB Output is correct
7 Correct 113 ms 31836 KB Output is correct
8 Correct 139 ms 59860 KB Output is correct
9 Runtime error 50 ms 65536 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -