Submission #84403

# Submission time Handle Problem Language Result Execution time Memory
84403 2018-11-15T07:00:42 Z talip Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
1000 ms 772 KB
#include <bits/stdc++.h>
#define ld long double
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 sqrt((lax-gox)*(lax-gox)+(lay-goy)*(lay-goy));
}

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(lax, lay, gox, goy), 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(lax, lay, gox, goy));
            maxdis=maxi(maxdis, calc(lax, lay, gox, goy));
            //cout << mindis << " " << maxdis << "\n";
        }
    }
    cout << setprecision(12) << fixed << mindis << " " << maxdis;
    
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:30:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;s.length()>i;i++){
                     ~~~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Correct 281 ms 376 KB Output is correct
2 Correct 358 ms 500 KB Output is correct
3 Correct 427 ms 500 KB Output is correct
4 Correct 488 ms 500 KB Output is correct
5 Correct 222 ms 500 KB Output is correct
6 Correct 314 ms 560 KB Output is correct
7 Correct 364 ms 672 KB Output is correct
8 Correct 491 ms 772 KB Output is correct
9 Execution timed out 1081 ms 772 KB Time limit exceeded
10 Halted 0 ms 0 KB -