답안 #882045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
882045 2023-12-02T13:45:26 Z alexdd 생물 실험 (IZhO13_expgorl) C++17
0 / 100
1000 ms 604 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long double ld;

int k;
string s;
int dist(int gx, int gy, int lx, int ly)
{
    return (gx-lx)*(gx-lx) + (gy-ly)*(gy-ly);
}
signed main()
{
    cin>>k>>s;
    //k = min(k, 15LL);
    int gx,gy,lx,ly;
    cin>>lx>>ly>>gx>>gy;
    int mnm = dist(gx,gy,lx,ly), mxm = dist(gx,gy,lx,ly);
    int poz=0;
    int lim = k * (int)s.size();
    for(int i=0;i<lim;i++)
    {
        if(s[poz]=='L')
        {
            gx--;
        }
        else if(s[poz]=='R')
        {
            gx++;
        }
        else if(s[poz]=='F')
        {
            gy++;
        }
        else if(s[poz]=='B')
        {
            gy--;
        }
        mnm = min(mnm, dist(gx,gy,lx,ly));
        mxm = max(mxm, dist(gx,gy,lx,ly));
        poz++;
        if(poz==(int)s.size())
            poz=0;
    }
    ld d1 = sqrt(mnm);
    ld d2 = sqrt(mxm);
    cout<<fixed<<setprecision(10)<<d1<<" "<<d2;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 348 KB Output is correct
2 Correct 60 ms 420 KB Output is correct
3 Correct 60 ms 412 KB Output is correct
4 Correct 62 ms 412 KB Output is correct
5 Correct 34 ms 344 KB Output is correct
6 Correct 48 ms 348 KB Output is correct
7 Correct 52 ms 600 KB Output is correct
8 Correct 83 ms 604 KB Output is correct
9 Execution timed out 1069 ms 348 KB Time limit exceeded
10 Halted 0 ms 0 KB -