답안 #1009050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009050 2024-06-27T08:23:10 Z bornag 생물 실험 (IZhO13_expgorl) C++14
0 / 100
369 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;

ll k;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cout << fixed << setprecision(9);
	
	cin >> k >> s;
	
	for(int i = 0; i < k; i++) cmd+=s;
	
	cin >> lx >> ly >> gx >> gy;
	
	ld mxi = -1;
	ld mni = LLONG_MAX;
	for(auto c : cmd){
		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';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 229 ms 34744 KB Output is correct
2 Correct 322 ms 26304 KB Output is correct
3 Correct 332 ms 30972 KB Output is correct
4 Correct 315 ms 31524 KB Output is correct
5 Correct 166 ms 20984 KB Output is correct
6 Correct 263 ms 44736 KB Output is correct
7 Correct 283 ms 33400 KB Output is correct
8 Correct 369 ms 61416 KB Output is correct
9 Runtime error 22 ms 65536 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -