#2733
Se dă un număr natural N si un șir v de N numere naturale. Sa se răspundă la Q întrebări de tipul:
D y: Care este cea mai mică poziție x, unde x > y, pentru care v[x] < v[y]? Dacă nu există o astfel de poziție, răspunsul acestei întrebări va fi N + 1.S y: Care este cea mai mare poziție x, unde x < y, pentru care v[x] < v[y]? Dacă nu există o astfel de poziție, răspunsul acestei întrebări va fi 0.| Problema | nrapp | Operații I/O |
nrapp.in/nrapp.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
| Id soluție | #63827474 | Utilizator | |
| Fișier | nrapp.cpp | Dimensiune | 820 B |
| Data încărcării | 20 Martie 2026, 11:42 | Scor/rezultat | Eroare de compilare |
nrapp.cpp: In function 'int main()': nrapp.cpp:18:15: error: reference to 'next' is ambiguous j=next[j]; ^ nrapp.cpp:7:5: note: candidates are: int next [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type) next(_ForwardIterator __x, typename ^ nrapp.cpp:20:13: error: reference to 'next' is ambiguous next[i]=j; ^ nrapp.cpp:7:5: note: candidates are: int next [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type) next(_ForwardIterator __x, typename ^ nrapp.cpp:22:13: error: reference to 'next' is ambiguous next[i]=N+1; ^ nrapp.cpp:7:5: note: candidates are: int next [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type) next(_ForwardIterator __x, typename ^ nrapp.cpp:28:15: error: reference to 'prev' is ambiguous j=prev[j]; ^ nrapp.cpp:7:19: note: candidates are: int prev [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:193:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type) prev(_BidirectionalIterator __x, typename ^ nrapp.cpp:30:13: error: reference to 'prev' is ambiguous prev[i]=j; ^ nrapp.cpp:7:19: note: candidates are: int prev [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:193:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type) prev(_BidirectionalIterator __x, typename ^ nrapp.cpp:32:13: error: reference to 'prev' is ambiguous prev[i]=0; ^ nrapp.cpp:7:19: note: candidates are: int prev [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:193:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type) prev(_BidirectionalIterator __x, typename ^ nrapp.cpp:41:19: error: reference to 'next' is ambiguous cout<<next[y]<<'\n'; ^ nrapp.cpp:7:5: note: candidates are: int next [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:184:5: note: template<class _ForwardIterator> _ForwardIterator std::next(_ForwardIterator, typename std::iterator_traits<_Iter>::difference_type) next(_ForwardIterator __x, typename ^ nrapp.cpp:43:19: error: reference to 'prev' is ambiguous cout<<prev[y]<<'\n'; ^ nrapp.cpp:7:19: note: candidates are: int prev [100005] int next[100005], prev[100005]; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:66:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from nrapp.cpp:1: /usr/include/c++/4.8/bits/stl_iterator_base_funcs.h:193:5: note: template<class _BidirectionalIterator> _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type) prev(_BidirectionalIterator __x, typename ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema nrapp 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ă.