Submission #84687

# Submission time Handle Problem Language Result Execution time Memory
84687 2018-11-16T14:02:48 Z talip Experiments with Gorlum (IZhO13_expgorl) C++14
Compilation error
0 ms 0 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;
    ld dis=maxdis;
    //cout << mindis << " " << maxdis;
    for(int r=0;min(k, 100)>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;
            dis=calc();
            mindis=mini(mindis, dis);
            maxdis=maxi(maxdis, dis);
            //cout << mindis << " " << maxdis << "\n";
        }
    }
    cout << setprecision(12) << fixed << mindis << " " << maxdis;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:31:27: error: no matching function for call to 'min(long double&, int)'
     for(int r=0;min(k, 100)>r;r++){
                           ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from expgorl.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
expgorl.cpp:31:27: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
     for(int r=0;min(k, 100)>r;r++){
                           ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from expgorl.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
expgorl.cpp:31:27: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
     for(int r=0;min(k, 100)>r;r++){
                           ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from expgorl.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
expgorl.cpp:31:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
     for(int r=0;min(k, 100)>r;r++){
                           ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from expgorl.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
expgorl.cpp:31:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
     for(int r=0;min(k, 100)>r;r++){
                           ^
expgorl.cpp:32:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;s.length()>i;i++){
                     ~~~~~~~~~~^~