#644
Se dă vectorul de tați al unui arbore cu rădăcină cu n noduri și doua noduri p q. Determinați drumul elementar de la nodul p la nodul q.
| Problema | DetDrum2 | Operații I/O |
detdrum2.in/detdrum2.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64319054 | Utilizator | |
| Fișier | detdrum2.cpp | Dimensiune | 568 B |
| Data încărcării | 29 Aprilie 2026, 13:21 | Scor/rezultat | Eroare de compilare |
detdrum2.cpp:5:15: warning: missing terminating " character 5 | ofstream cout("detdrum2.out); | ^ detdrum2.cpp:5:15: error: missing terminating " character 5 | ofstream cout("detdrum2.out); | ^~~~~~~~~~~~~~~ detdrum2.cpp:6:7: error: ‘q’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^ detdrum2.cpp:6:9: error: ‘T’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^ detdrum2.cpp:6:16: error: ‘p’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^ detdrum2.cpp:6:18: error: ‘DP’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^~ detdrum2.cpp:6:26: error: ‘cp’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^~ detdrum2.cpp:6:29: error: ‘DQ’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^~ detdrum2.cpp:6:37: error: ‘cq’ has not been declared 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^~ detdrum2.cpp:6:39: error: expected ‘)’ before ‘;’ token 6 | int n,q,T[101],p,DP[101],cp,DQ[101],cq; | ^ | ) detdrum2.cpp:5:14: note: to match this ‘(’ 5 | ofstream cout("detdrum2.out); | ^ detdrum2.cpp: In function ‘int main()’: detdrum2.cpp:10:10: error: ‘n’ was not declared in this scope 10 | cin>>n>>p>>q; | ^ detdrum2.cpp:10:13: error: ‘p’ was not declared in this scope 10 | cin>>n>>p>>q; | ^ detdrum2.cpp:10:16: error: ‘q’ was not declared in this scope 10 | cin>>n>>p>>q; | ^ detdrum2.cpp:12:14: error: ‘T’ was not declared in this scope 12 | cin>>T[i]; | ^ detdrum2.cpp:15:9: error: ‘DP’ was not declared in this scope 15 | DP[++cp]=p; | ^~ detdrum2.cpp:15:14: error: ‘cp’ was not declared in this scope 15 | DP[++cp]=p; | ^~ detdrum2.cpp:16:11: error: ‘T’ was not declared in this scope 16 | p=T[p]; | ^ detdrum2.cpp:20:9: error: ‘DQ’ was not declared in this scope 20 | DQ[++cq]=q; | ^~ detdrum2.cpp:20:14: error: ‘cq’ was not declared in this scope 20 | DQ[++cq]=q; | ^~ detdrum2.cpp:21:11: error: ‘T’ was not declared in this scope 21 | q=T[q]; | ^ detdrum2.cpp:23:11: error: ‘DP’ was not declared in this scope 23 | while(DP[cp]==DQ[cq]) | ^~ detdrum2.cpp:23:14: error: ‘cp’ was not declared in this scope 23 | while(DP[cp]==DQ[cq]) | ^~ detdrum2.cpp:23:19: error: ‘DQ’ was not declared in this scope 23 | while(DP[cp]==DQ[cq]) | ^~ detdrum2.cpp:23:22: error: ‘cq’ was not declared in this scope 23 | while(DP[cp]==DQ[cq]) | ^~ detdrum2.cpp:28:20: error: ‘cp’ was not declared in this scope 28 | for(int i=1;i<=cp;i++) | ^~ detdrum2.cpp:29:15: error: ‘DP’ was not declared in this scope 29 | cout<<DP[i]<<" "; | ^~ detdrum2.cpp:30:15: error: ‘cq’ was not declared in this scope 30 | for(int i=cq+1;i>=1;i--) | ^~ detdrum2.cpp:31:15: error: ‘DQ’ was not declared in this scope 31 | cout<<DQ[i]<<" "; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DetDrum2 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ă.