답안 #84427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84427 2018-11-15T07:36:46 Z talip 생물 실험 (IZhO13_expgorl) C++14
0 / 100
225 ms 504 KB
#include <bits/stdc++.h>
#define ld long double
#define calc() sqrtl((lax-gox)*(lax-gox)+(lay-goy)*(lay-goy))
using namespace std;
 
ld mini(ld a, ld b){
    if(a>b){
        return b;
    }
    return a;
}
 
ld maxi(ld a, ld b){
    if(a>b){
        return a;
    }
    return b;
}
/*
ld calc(ld lax, ld lay, ld gox, ld goy){
    return ;
}*/
 
int main(){
    ios::sync_with_stdio(false);    cin.tie(NULL);  cout.tie(NULL);
    ld k;  string s;    cin >> k >> s;
    ld lax, lay, gox, goy; cin >> lax >> lay >> gox >> goy;
    ld mindis=calc(), maxdis; maxdis=mindis;
    ld dis=maxdis;
    int x[10004], y[10004]; x[0]=lax-gox;   y[0]=lay-goy;
    //cout << mindis << " " << maxdis;
    int n=s.length()+1;
    for(int i=0;n>i;i++){
        x[i+1]=x[i];    y[i+1]=y[i];
        if(s[i]=='I'){
            continue;
        }
        if(s[i]=='R'){
            x[i+1]++; continue;
        }
        else if(s[i]=='L'){
            x[i+1]--; continue;
        }
        else if(s[i]=='F'){
            y[i+1]++; continue;
        }
        else if(s[i]=='B'){
            y[i+1]--; continue;
        }
    }
    for(int i=0;n>=i;i++){
        for(int j=0;k>j;j++){
            dis=sqrtl(1LL*(x[i]+(x[n]-x[0])*j)*(x[i]+(x[n]-x[0])*j)+1LL*(y[i]+(y[n]-y[0])*j)*(y[i]+(y[n]-y[0])*j));
			mindis=mini(mindis, dis);  maxdis=maxi(maxdis, dis);
        }
        
    }
    /*
    for(int r=0;k>r;r++){
        for(int i=0;s.length()>i;i++){
          	if(s[i]=='I')continue;
            if(s[i]=='R')gox++;
            else if(s[i]=='L')gox--;
            else if(s[i]=='F')goy++;
            else if(s[i]=='B')goy--;
            dis=calc();
            mindis=mini(mindis, dis);
            maxdis=maxi(maxdis, dis);
            //cout << mindis << " " << maxdis << "\n";
        }
    }*/
    cout << setprecision(12) << fixed << mindis << " " << maxdis;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 225 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -