#4686
O listă simplu înlănțuită are cheile nodurilor, în valoare absolută, ordonate crescător. Să se reordoneze nodurile astfel încât cheile să fie ordonate crescător.
Problemă de interviu
Problema | FLsiReord | Operații I/O |
![]() flsireord.in /flsireord.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
Id soluție | #57499983 | Utilizator | |
Fișier | flsireord.cpp | Dimensiune | 949 B |
Data încărcării | 02 Aprilie 2025, 14:41 | Scor / rezultat | Eroare de compilare |
flsireord.cpp:25:18: error: reference to 'stack' is ambiguous void push(struct stack *stack, int val) ^ flsireord.cpp:20:8: note: candidates are: struct stack struct stack { ^ In file included from /usr/include/c++/4.8/stack:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:88, from flsireord.cpp:1: /usr/include/c++/4.8/bits/stl_stack.h:96:11: note: template<class _Tp, class _Sequence> class std::stack class stack ^ flsireord.cpp: In function 'void push(int*, int)': flsireord.cpp:27:20: error: expected type-specifier before 'nod' nod *nod = new nod; ^ flsireord.cpp:30:16: error: request for member 'head' in '* stack', which is of non-class type 'int' if (stack->head == nullptr) { ^ flsireord.cpp:31:16: error: request for member 'head' in '* stack', which is of non-class type 'int' stack->head = nod; ^ flsireord.cpp:33:27: error: request for member 'head' in '* stack', which is of non-class type 'int' nod->urm = stack->head; ^ flsireord.cpp:34:16: error: request for member 'head' in '* stack', which is of non-class type 'int' stack->head = stack->head->urm; ^ flsireord.cpp:34:30: error: request for member 'head' in '* stack', which is of non-class type 'int' stack->head = stack->head->urm; ^ flsireord.cpp: In function 'void Reord(nod*&)': flsireord.cpp:40:12: error: reference to 'stack' is ambiguous struct stack *stack = new stack; ^ flsireord.cpp:20:8: note: candidates are: struct stack struct stack { ^ In file included from /usr/include/c++/4.8/stack:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:88, from flsireord.cpp:1: /usr/include/c++/4.8/bits/stl_stack.h:96:11: note: template<class _Tp, class _Sequence> class std::stack class stack ^ flsireord.cpp:40:25: error: invalid type in declaration before '=' token struct stack *stack = new stack; ^ flsireord.cpp:40:31: error: expected type-specifier before 'stack' struct stack *stack = new stack; ^ flsireord.cpp:41:12: error: request for member 'head' in '* stack', which is of non-class type 'int' stack->head = nullptr; ^ flsireord.cpp:42:12: error: request for member 'tail' in '* stack', which is of non-class type 'int' stack->tail = nullptr; ^ flsireord.cpp:45:13: error: 'curren' was not declared in this scope if (curren->info < 0) { ^ flsireord.cpp:46:34: error: 'struct nod' has no member named 'val' push(stack, current->val); ^ flsireord.cpp:48:29: error: no matching function for call to 'nod::nod()' nod *node = new nod; ^ flsireord.cpp:48:29: note: candidates are: flsireord.cpp:8:5: note: nod::nod(int) nod(int x) ^ flsireord.cpp:8:5: note: candidate expects 1 argument, 0 provided flsireord.cpp:4:8: note: constexpr nod::nod(const nod&) struct nod ^ flsireord.cpp:4:8: note: candidate expects 1 argument, 0 provided flsireord.cpp:4:8: note: constexpr nod::nod(nod&&) flsireord.cpp:4:8: note: candidate expects 1 argument, 0 provided flsireord.cpp:50:24: error: request for member 'head' in '* stack', which is of non-class type 'int' if (stack->head == nullptr) { ^ flsireord.cpp:51:24: error: request for member 'head' in '* stack', which is of non-class type 'int' stack->head = stack->tail = node; ^ flsireord.cpp:51:38: error: request for member 'tail' in '* stack', which is of non-class type 'int' stack->head = stack->tail = node; ^ flsireord.cpp:53:24: error: request for member 'tail' in '* stack', which is of non-class type 'int' stack->tail->urm = node; ^ flsireord.cpp:54:24: error: request for member 'tail' in '* stack', which is of non-class type 'int' stack->tail = node; ^ flsireord.cpp:59:19: error: request for member 'head' in '* stack', which is of non-class type 'int' head = stack->head; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FLsiReord face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.