답안 #89048

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89048 2018-12-10T09:03:05 Z mate 생물 실험 (IZhO13_expgorl) C++14
0 / 100
1000 ms 620 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    double k,x1,x2,y1,y2,mx,mn;
    string s;
    cin>>k;
    cin>>s;
    cin>>x1>>y1;
    cin>>x2>>y2;


    mx=sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
    mn=mx;


   for(double i=0;i<k;i++)
       for(double j=0;j<s.size();j++){
           if(s[j]=='L'){
              x2=x2-1;
             }
           if(s[j]=='R'){
            x2=x2+1;

           }
           if(s[j]=='F'){
            y2=y2+1;

       }
       if(s[j]=='B'){
            y2=y2-1;

            }
            mx=max(mx,sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2)));
              mn=min(mn,sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2)));
       }
       cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;

    return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    for(double i=0;i<k;i++)
    ^~~
expgorl.cpp:39:8: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
        cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;
        ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 127 ms 376 KB Output is correct
2 Correct 180 ms 500 KB Output is correct
3 Correct 229 ms 508 KB Output is correct
4 Correct 267 ms 588 KB Output is correct
5 Correct 105 ms 604 KB Output is correct
6 Correct 149 ms 604 KB Output is correct
7 Correct 220 ms 604 KB Output is correct
8 Correct 287 ms 620 KB Output is correct
9 Execution timed out 1065 ms 620 KB Time limit exceeded
10 Halted 0 ms 0 KB -