답안 #89022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89022 2018-12-10T08:25:00 Z tamazineb 생물 실험 (IZhO13_expgorl) C++14
0 / 100
3 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n,mx;
int a[1],b[1];
double j=1000000,p=-1;
cin>>n;
string s;
cin>>s;
cin>>a[0]>>a[1];
cin>>b[0]>>b[1];
for(int w=0;w<n;w++){
for(int k=0;k<s.size();k++){
   if(s[k]=='L') {
    b[0]--;
    mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));

   }
   if(s[k]=='R'){
    b[0]++;
 mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));   }
    if(s[k]=='F'){
       b[1]++;
 mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));

    }
    if(s[k]=='B'){
        b[1]--;
 mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));    }
    if(s[k]=='I'){
 mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
    }

 if(mx>p)
 p=mx;

 if(mx<j)
    j=mx;
}
mx=0;
}

cout<<fixed<<setprecision(9)<<j<<" ";
cout<<fixed<<setprecision(9)<<p;
    return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:15:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int k=0;k<s.size();k++){
             ~^~~~~~~~~
expgorl.cpp:18:41: warning: array subscript is above array bounds [-Warray-bounds]
     mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
                                      ~~~^
expgorl.cpp:18:46: warning: array subscript is above array bounds [-Warray-bounds]
     mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
                                           ~~~^
expgorl.cpp:23:38: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));   }
                                   ~~~^
expgorl.cpp:23:43: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));   }
                                        ~~~^
expgorl.cpp:25:11: warning: array subscript is above array bounds [-Warray-bounds]
        b[1]++;
        ~~~^
expgorl.cpp:25:11: warning: array subscript is above array bounds [-Warray-bounds]
expgorl.cpp:26:38: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
                                   ~~~^
expgorl.cpp:30:12: warning: array subscript is above array bounds [-Warray-bounds]
         b[1]--;
         ~~~^
expgorl.cpp:30:12: warning: array subscript is above array bounds [-Warray-bounds]
expgorl.cpp:31:38: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));    }
                                   ~~~^
expgorl.cpp:33:38: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
                                   ~~~^
expgorl.cpp:33:43: warning: array subscript is above array bounds [-Warray-bounds]
  mx=sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
                                        ~~~^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -