답안 #84405

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84405 2018-11-15T07:03:27 Z talip 생물 실험 (IZhO13_expgorl) C++14
0 / 100
1000 ms 704 KB
#include <bits/stdc++.h>
#define ld long double
#define calc() sqrt((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;
    //cout << mindis << " " << maxdis;
    for(int r=0;k>r;r++){
        for(int i=0;s.length()>i;i++){
            if(s[i]=='R')gox++;
            if(s[i]=='L')gox--;
            if(s[i]=='F')goy++;
            if(s[i]=='B')goy--;
            if(s[i]=='I')continue;
            //cout << gox << " " << goy << "\n";
            mindis=mini(mindis, calc());
            maxdis=maxi(maxdis, calc());
            //cout << mindis << " " << maxdis << "\n";
        }
    }
    cout << setprecision(12) << fixed << mindis << " " << maxdis;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:31:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;s.length()>i;i++){
                     ~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 288 ms 376 KB Output is correct
2 Correct 361 ms 508 KB Output is correct
3 Correct 452 ms 508 KB Output is correct
4 Correct 477 ms 508 KB Output is correct
5 Correct 209 ms 508 KB Output is correct
6 Correct 323 ms 528 KB Output is correct
7 Correct 373 ms 588 KB Output is correct
8 Correct 494 ms 704 KB Output is correct
9 Execution timed out 1069 ms 704 KB Time limit exceeded
10 Halted 0 ms 0 KB -