#1197
Robotics
Ne aflăm în secția de vopsitorie a uzinei Toyota Motor unde inginerii japonezi prezintă ultimul tip de robot industrial de vopsire. În dorința de a evidenția calitatea și viteza de execuție a roboților, inginerii folosesc pentru demonstrație o tablă de dimensiunea n×n
, împărțită în pătrate cu latura egală cu 1
, reprezentată sub forma unui tablou bidimensional cu n
linii şi n
coloane.
Un robot utilizat pentru vopsire are două brațe telescopice care se deplasează de-a lungul unei axe. Fiecare braț poate vopsi într-o unitate de timp un singur pătrat. La momentul de timp t=0
robotul primește comanda de a se poziționa într-un pătrat specificat prin coordonatele (x,y)
.
În funcție de traiectoria de deplasare roboții folosiți sunt de două tipuri. La momentul de timp t
robotul de tip 1
vopsește pătratele aflate la coordonatele: (x-t,y+t)
și (x+t,y-t)
, iar robotul de tip 2 vopsește pătratele aflate la coordonatele: (x+t,y+t)
și (x-t,y-t)
. Pentru vopsirea unui pătrat se consumă 1 litru de vopsea.
Pe tablă sunt așezați m
roboți.
Cunoscând pentru cei m
roboți coordonatele inițiale (x[i],y[i])
, i=1,…,m
, se cere să se determine:
a) Cantitatea totală de vopsea care a fost folosită de roboți după t
unități de timp
b) Numărul minim de unități de timp necesare formării primului dreptunghi cu arie nenulă. Un dreptunghi corect format este rezultatul intersecției a două traiectorii paralele a doi roboți de tip 1
cu două traiectorii paralele a doi roboți de tip 2
, iar colțurile dreptunghiului sunt 4
pătrate care au fost vopsite de doi roboți de tipuri diferite.
Problema | Robotics | Operații I/O |
robotics.in /robotics.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #51915479 | Utilizator | |
Fișier | robotics.cpp | Dimensiune | 2.00 KB |
Data încărcării | 08 Septembrie 2024, 15:15 | Scor / rezultat | Eroare de compilare |
robotics.cpp: In function 'bool v(long long int)': robotics.cpp:22:50: error: no matching function for call to 'min(int, long long int)' d1=min(a,min(v1[x].first-1,n-v1[x].second)); ^ robotics.cpp:22:50: 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: robotics.cpp:22:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') d1=min(a,min(v1[x].first-1,n-v1[x].second)); ^ 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: robotics.cpp:22:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') d1=min(a,min(v1[x].first-1,n-v1[x].second)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: robotics.cpp:22:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int' d1=min(a,min(v1[x].first-1,n-v1[x].second)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: robotics.cpp:22:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int' d1=min(a,min(v1[x].first-1,n-v1[x].second)); ^ robotics.cpp:23:50: error: no matching function for call to 'min(long long int, int)' d2=min(a,min(n-v1[x].first,v1[x].second-1)); ^ robotics.cpp:23:50: 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: robotics.cpp:23:50: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') d2=min(a,min(n-v1[x].first,v1[x].second-1)); ^ 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: robotics.cpp:23:50: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') d2=min(a,min(n-v1[x].first,v1[x].second-1)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: robotics.cpp:23:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' d2=min(a,min(n-v1[x].first,v1[x].second-1)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: robotics.cpp:23:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' d2=min(a,min(n-v1[x].first,v1[x].second-1)); ^ robotics.cpp:29:49: error: no matching function for call to 'min(long long int&, const int&)' d1=min(a,min(v2[y].first-1,v2[y].second-1)); ^ robotics.cpp:29:49: 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: robotics.cpp:29:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') d1=min(a,min(v2[y].first-1,v2[y].second-1)); ^ 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: robotics.cpp:29:49: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') d1=min(a,min(v2[y].first-1,v2[y].second-1)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: robotics.cpp:29:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' d1=min(a,min(v2[y].first-1,v2[y].second-1)); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from robotics.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: robotics.cpp:29:49: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' d1=min(a,min(v2[y].first-1,v2[y].second-1)); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Robotics 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ă.