Submission #229753

#TimeUsernameProblemLanguageResultExecution timeMemory
229753Ruxandra985Triangles (CEOI18_tri)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; int v[40010] , x[40010] , y[40010] , s[40010]; int poz (int st,int dr){ int ds=0,dd=-1,aux; while (st!=dr){ if (is_clockwise(1 , st , dr)){ aux=v[st]; v[st]=v[dr]; v[dr]=aux; aux=ds; ds=-dd; dd=-aux; } st+=ds; dr+=dd; } return st; } void sorteaza (int st,int dr){ if (st<dr){ int pivr = ((long long)rand()*rand())%(dr-st+1)+st; int p = poz(st , pivr); p = poz(p , dr); sorteaza (st , p-1); sorteaza (p+1 , dr); } } int main() { int n , i , elem , j; n = get_n(); /// stergi citirea, folosesti get_n for (i = 1 ; i <= n ; i++) v[i] = i; sorteaza (2 , n); /*for (i = 1 ; i <= n ; i++){ fprintf (fout,"%d\n" , v[i]); }*/ v[n + 1] = 1; s[1] = v[1]; s[2] = v[2]; elem = 2; for (j = 3 ; j <= n + 1 ; j++){ while (elem >= 2 && is_clockwise (s[elem - 1] , s[elem] , v[j])) elem--; s[++elem] = v[j]; } if (n >= 3) elem = max(elem , 4LL); give_answer(elem - 1); return 0; }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:61:28: error: no matching function for call to 'max(int&, long long int)'
       elem = max(elem , 4LL);
                            ^
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 tri.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
tri.cpp:61:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
       elem = max(elem , 4LL);
                            ^
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 tri.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
tri.cpp:61:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
       elem = max(elem , 4LL);
                            ^
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 tri.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
tri.cpp:61:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
       elem = max(elem , 4LL);
                            ^
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 tri.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
tri.cpp:61:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
       elem = max(elem , 4LL);
                            ^