Submission #339271

# Submission time Handle Problem Language Result Execution time Memory
339271 2020-12-25T03:09:12 Z beksultan04 Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
64 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-15
const int N = 1e5+12,INF=1e9+7;

int disting(int x,int y,int x1,int y1){
    ret ((x-x1)*(x-x1))+((y-y1)*(y-y1));
}

main(){
    int k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
    string s;
    cin>>k>>s>>x>>y>>x1>>y1;
    while (k--){
        s += s;
    }
    cout <<fixed <<setprecision(12);
    mn = disting(x,y,x1,y1);
    mx = disting(x,y,x1,y1);
    for (i=0;i<s.size();++i){
        if (s[i] == 'L'){
            x1--;
        }
        if (s[i] == 'R'){
            x1++;
        }
        if (s[i] == 'F'){
            y1++;
        }
        if (s[i] == 'B'){
            y1--;
        }
        mn = min(mn,disting(x,y,x1,y1));
        mx = max(mx,disting(x,y,x1,y1));

    }
    cout <<sqrt(mn)<<" "<<sqrt(mx);
}







Compilation message

expgorl.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      |      ^
expgorl.cpp: In function 'int main()':
expgorl.cpp:36:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for (i=0;i<s.size();++i){
      |              ~^~~~~~~~~
expgorl.cpp:27:13: warning: unused variable 'j' [-Wunused-variable]
   27 |     int k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
      |             ^
expgorl.cpp:27:21: warning: unused variable 'l' [-Wunused-variable]
   27 |     int k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
      |                     ^
expgorl.cpp:27:25: warning: unused variable 'r' [-Wunused-variable]
   27 |     int k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
      |                         ^
# Verdict Execution time Memory Grader output
1 Runtime error 64 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -