Submission #89078

# Submission time Handle Problem Language Result Execution time Memory
89078 2018-12-10T09:36:04 Z mate Experiments with Gorlum (IZhO13_expgorl) C++17
0 / 100
1000 ms 572 KB
#include <bits/stdc++.h>

using namespace std;

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


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


   for(int i=0;i<k;i++)
       for(int 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;

            t=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

            mx=max(mx,t);
            mn=min(mn,t);
            

            //mx=max(mx,t*k);
            //mn=min(mn,t*k);
       }
       
       cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;

    return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:20:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
        for(int j=0;j<s.size();j++){
                    ~^~~~~~~~~
expgorl.cpp:27:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
        if(s[j]=='B')
        ^~
expgorl.cpp:30:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
             t=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
             ^
expgorl.cpp:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    for(int i=0;i<k;i++)
    ^~~
expgorl.cpp:40: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;
        ^~~~
# Verdict Execution time Memory Grader output
1 Correct 105 ms 400 KB Output is correct
2 Correct 134 ms 508 KB Output is correct
3 Correct 151 ms 572 KB Output is correct
4 Correct 159 ms 572 KB Output is correct
5 Correct 80 ms 572 KB Output is correct
6 Correct 121 ms 572 KB Output is correct
7 Correct 134 ms 572 KB Output is correct
8 Correct 182 ms 572 KB Output is correct
9 Execution timed out 1082 ms 572 KB Time limit exceeded
10 Halted 0 ms 0 KB -