답안 #1009157

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009157 2024-06-27T09:25:52 Z bornag 생물 실험 (IZhO13_expgorl) C++14
0 / 100
1000 ms 436 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
ll lx, ly, gx, gy;
string s, si;

unordered_map<int, ld> sqs;
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;
		
	ld mxi = -1;
	ld mni = LLONG_MAX;
	
	ld di = 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 = abs(gx-lx)*abs(gx-lx) + abs(gy-ly)*abs(gy-ly);
			mxi = max(mxi, di);
			mni = min(mni, di);
		}
	}
	
	cout << sqrt(mni) << ' ' << sqrt(mxi) << '\n';
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 0; i < si.size(); i++){
      |                 ~~^~~~~~~~~~~
expgorl.cpp:38:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(int j = 0; j < s.size(); j++){
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 436 KB Output is correct
2 Correct 102 ms 348 KB Output is correct
3 Correct 111 ms 344 KB Output is correct
4 Correct 122 ms 348 KB Output is correct
5 Correct 62 ms 348 KB Output is correct
6 Correct 95 ms 428 KB Output is correct
7 Correct 109 ms 436 KB Output is correct
8 Correct 147 ms 348 KB Output is correct
9 Execution timed out 1081 ms 348 KB Time limit exceeded
10 Halted 0 ms 0 KB -