Detalii evaluare #64319054

Rezumat problemă

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.

Detalii

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 gaurean sara maria (gaureansara08)
Fișier detdrum2.cpp Dimensiune 568 B
Data încărcării 29 Aprilie 2026, 13:21 Scor/rezultat Eroare de compilare

Evaluare

Mesaj 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]<<" ";
      |               ^~

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema DetDrum2 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.

Du-te sus!