#1209
TDrept
Se consideră N
puncte de coordonate întregi în sistemul de coordonate cartezian.
Scrieţi un program care determină numărul de triunghiuri dreptunghice având vârfurile plasate în 3
dintre punctele date şi catetele respectiv paralele cu axele de coordonate.
ONI GIM 2014, Clasa a VIII-a
Problema | TDrept | Operații I/O |
![]() tdrept.in /tdrept.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 1 MB
|
Id soluție | #57185956 | Utilizator | |
Fișier | tdrept.cpp | Dimensiune | 790 B |
Data încărcării | 19 Martie 2025, 14:51 | Scor / rezultat | Eroare de compilare |
tdrept.cpp: In function 'int main()': tdrept.cpp:29:77: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type)' ans += max(0ll, (((x[a[i].first] - 1) * (y[a[i].second] - 1))) % MOD), ans %= MOD; ^ tdrept.cpp:29:77: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from tdrept.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: tdrept.cpp:29:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}') ans += max(0ll, (((x[a[i].first] - 1) * (y[a[i].second] - 1))) % MOD), ans %= MOD; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from tdrept.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: tdrept.cpp:29:77: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}') ans += max(0ll, (((x[a[i].first] - 1) * (y[a[i].second] - 1))) % MOD), ans %= MOD; ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from tdrept.cpp:6: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: tdrept.cpp:29:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans += max(0ll, (((x[a[i].first] - 1) * (y[a[i].second] - 1))) % MOD), ans %= MOD; ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from tdrept.cpp:6: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: tdrept.cpp:29:77: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' ans += max(0ll, (((x[a[i].first] - 1) * (y[a[i].second] - 1))) % MOD), ans %= MOD; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema TDrept face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.