Submission #89012

# Submission time Handle Problem Language Result Execution time Memory
89012 2018-12-10T08:15:54 Z luka1234 Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
110 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    double n,x1,x2,y1,y2,mx=0.0,mn=0.0;
    string s;
    cin>>n;
    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<n;i++)
       for(double j=0;j<s.size();j++){
           if(s[j]=='L'){
              x2=x2-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)));

           }
           if(s[j]=='R'){
            x2=x2+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)));
           }
           if(s[j]=='F'){
            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)));

       }
       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)<<mx<<' '<<fixed<<setprecision(9)<<mn;

    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<n;i++)
    ^~~
expgorl.cpp:45:8: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
        cout<<fixed<<setprecision(9)<<mx<<' '<<fixed<<setprecision(9)<<mn;
        ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -