제출 #90549

#제출 시각아이디문제언어결과실행 시간메모리
90549popovicirobert생물 실험 (IZhO13_expgorl)C++14
0 / 100
1070 ms756 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long #define ld long double // 217 // 44 using namespace std; const int MAXK = (int) 1e5; char dx[256], dy[256]; inline double dist(double x1, double y1, double x2, double y2) { return 1.0 * (x1 - x2) * (x1 - x2) + 1.0 * (y1 - y2) * (y1 - y2); } inline void upd(double &mn, double &mx, double cur) { mn = min(mn, cur); mx = max(mx, cur); } string str; double dst[MAXK + 1]; int main() { //ifstream cin("A.in"); //ofstream cout("A.out"); int i, k; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> k >> str; double lx, ly, gx, gy; cin >> lx >> ly >> gx >> gy; dx['L'] = -1, dx['R'] = 1; dy['F'] = 1, dy['B'] = -1; int x = 0, y = 0; for(auto it : str) { x += dx[it], y += dy[it]; } double mn = 1e18, mx = 0; if(x == 0 && y == 0) { upd(mn, mx, dist(lx, ly, gx, gy)); for(auto it : str) { x += dx[it], y += dy[it]; upd(mn, mx, dist(lx, ly, x + gx, y + gy)); } cout << fixed << setprecision(20) << mn << " " << mx; return 0; } upd(mn, mx, dist(lx, ly, gx, gy)); while(k > 0) { k--; for(auto it : str) { gx += dx[it], gy += dy[it]; upd(mn, mx, dist(lx, ly, gx, gy)); } } mn = sqrt(mn), mx = sqrt(mx); cout << fixed << setprecision(20) << mn << " " << mx; //cin.close(); //cout.close(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

expgorl.cpp: In function 'int main()':
expgorl.cpp:40:19: warning: array subscript has type 'char' [-Wchar-subscripts]
         x += dx[it], y += dy[it];
                   ^
expgorl.cpp:40:32: warning: array subscript has type 'char' [-Wchar-subscripts]
         x += dx[it], y += dy[it];
                                ^
expgorl.cpp:46:23: warning: array subscript has type 'char' [-Wchar-subscripts]
             x += dx[it], y += dy[it];
                       ^
expgorl.cpp:46:36: warning: array subscript has type 'char' [-Wchar-subscripts]
             x += dx[it], y += dy[it];
                                    ^
expgorl.cpp:56:24: warning: array subscript has type 'char' [-Wchar-subscripts]
             gx += dx[it], gy += dy[it];
                        ^
expgorl.cpp:56:38: warning: array subscript has type 'char' [-Wchar-subscripts]
             gx += dx[it], gy += dy[it];
                                      ^
expgorl.cpp:30:9: warning: unused variable 'i' [-Wunused-variable]
     int i, k;
         ^
#Verdict Execution timeMemoryGrader output
Fetching results...