Detalii evaluare #50422718

Rezumat problemă

Se dă un arbore binar care conține valori numere naturale. Se dau k noduri din arbore și se cere determinarea, pentru fiecare nod, a numărului de noduri din subarborele cu rădăcina în acel nod.

Detalii

Problema CountSub Operații I/O countsub.in/countsub.out
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #50422718 Utilizator Balan Otniel (BalanOtniel)
Fișier countsub.cpp Dimensiune 2.14 KB
Data încărcării 09 Aprilie 2024, 08:58 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

countsub.cpp:2:10: error: stray '#' in program
 Problema #674 – CountSub – Rezolvari PBInfo

          ^
countsub.cpp:2:1: error: stray '\342' in program
 Problema #674 – CountSub – Rezolvari PBInfo

 ^
countsub.cpp:2:1: error: stray '\200' in program
countsub.cpp:2:1: error: stray '\223' in program
countsub.cpp:2:1: error: stray '\342' in program
countsub.cpp:2:1: error: stray '\200' in program
countsub.cpp:2:1: error: stray '\223' in program
countsub.cpp:4:1: error: stray '\310' in program
 Cerința

 ^
countsub.cpp:4:1: error: stray '\233' in program
countsub.cpp:5:1: error: stray '\304' in program
 Considerăm un arbore binar cu n noduri în care fiecare nod este numerotat de la 1 la n și conține o valoare număr natural. Se dau k noduri din arbore și se cere determinarea, pentru fiecare nod, a numărului de noduri din subarborele cu rădăcina în acel nod.

 ^
countsub.cpp:5:1: error: stray '\203' in program
countsub.cpp:5:1: error: stray '\303' in program
countsub.cpp:5:1: error: stray '\256' in program
countsub.cpp:5:1: error: stray '\310' in program
countsub.cpp:5:1: error: stray '\231' in program
countsub.cpp:5:1: error: stray '\310' in program
countsub.cpp:5:1: error: stray '\233' in program
countsub.cpp:5:1: error: stray '\304' in program
countsub.cpp:5:1: error: stray '\203' in program
countsub.cpp:5:1: error: stray '\310' in program
countsub.cpp:5:1: error: stray '\231' in program
countsub.cpp:5:1: error: stray '\304' in program
countsub.cpp:5:1: error: stray '\203' in program
countsub.cpp:5:1: error: stray '\304' in program
countsub.cpp:5:1: error: stray '\203' in program
countsub.cpp:5:1: error: stray '\304' in program
countsub.cpp:5:1: error: stray '\203' in program
countsub.cpp:5:1: error: stray '\303' in program
countsub.cpp:5:1: error: stray '\256' in program
countsub.cpp:8:1: error: stray '\310' in program
 Fișierul de intrare countsub.in conține pe prima linie numărul n. Fiecare dintre următoarele n linii contine câte 3 numere X st dr; linia i + 1 din fișier conține informatiile despre nodul numerotat cu i: X reprezintă valoare din nod, st reprezintă numărul de ordine al descendentului stâng sau 0 dacă nodul i nu are descendent stâng, iar dr reprezintă numărul de ordine al descendentului drept sau 0 dacă nodul i nu are descendent drept.

 ^
countsub.cpp:8:1: error: stray '\231' in program
countsub.cpp:8:1: error: stray '\310' in program
countsub.cpp:8:1: error: stray '\233' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\303' in program
countsub.cpp:8:1: error: stray '\242' in program
countsub.cpp:8:1: error: stray '\310' in program
countsub.cpp:8:1: error: stray '\231' in program
countsub.cpp:8:1: error: stray '\310' in program
countsub.cpp:8:1: error: stray '\233' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\303' in program
countsub.cpp:8:1: error: stray '\242' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\303' in program
countsub.cpp:8:1: error: stray '\242' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:8:1: error: stray '\304' in program
countsub.cpp:8:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\304' in program
 Pe următoarea linie se află numărul k, iar pe fiecare dintre următoarele k linii se află câte un număr natural cuprins între 1 și n, reprezentând nodul curent.

 ^
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\304' in program
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\304' in program
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\304' in program
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\304' in program
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\303' in program
countsub.cpp:10:1: error: stray '\242' in program
countsub.cpp:10:1: error: stray '\304' in program
countsub.cpp:10:1: error: stray '\203' in program
countsub.cpp:10:1: error: stray '\303' in program
countsub.cpp:10:1: error: stray '\256' in program
countsub.cpp:10:1: error: stray '\310' in program
countsub.cpp:10:1: error: stray '\231' in program
countsub.cpp:10:1: error: stray '\303' in program
countsub.cpp:10:1: error: stray '\242' in program
countsub.cpp:12:1: error: stray '\310' in program
 Date de ieșire

 ^
countsub.cpp:12:1: error: stray '\231' in program
countsub.cpp:13:1: error: stray '\310' in program
 Fișierul de ieșire countsub.out va conține k linii; fiecare linie va conține numărul de noduri din subarborele cu rădăcina în nodul corespunzător.

 ^
countsub.cpp:13:1: error: stray '\231' in program
countsub.cpp:13:1: error: stray '\310' in program
countsub.cpp:13:1: error: stray '\231' in program
countsub.cpp:13:1: error: stray '\310' in program
countsub.cpp:13:1: error: stray '\233' in program
countsub.cpp:13:1: error: stray '\310' in program
countsub.cpp:13:1: error: stray '\233' in program
countsub.cpp:13:1: error: stray '\304' in program
countsub.cpp:13:1: error: stray '\203' in program
countsub.cpp:13:1: error: stray '\304' in program
countsub.cpp:13:1: error: stray '\203' in program
countsub.cpp:13:1: error: stray '\304' in program
countsub.cpp:13:1: error: stray '\203' in program
countsub.cpp:13:1: error: stray '\303' in program
countsub.cpp:13:1: error: stray '\256' in program
countsub.cpp:13:1: error: stray '\304' in program
countsub.cpp:13:1: error: stray '\203' in program
countsub.cpp:15:1: error: stray '\310' in program
 Restricții și precizări

 ^
countsub.cpp:15:1: error: stray '\233' in program
countsub.cpp:15:1: error: stray '\310' in program
countsub.cpp:15:1: error: stray '\231' in program
countsub.cpp:15:1: error: stray '\304' in program
countsub.cpp:15:1: error: stray '\203' in program
countsub.cpp:16:1: error: stray '\342' in program
 1 ≤ n ≤ 1000

 ^
countsub.cpp:16:1: error: stray '\211' in program
countsub.cpp:16:1: error: stray '\244' in program
countsub.cpp:16:1: error: stray '\342' in program
countsub.cpp:16:1: error: stray '\211' in program
countsub.cpp:16:1: error: stray '\244' in program
countsub.cpp:17:62: error: too many decimal points in number
 valorile din nodurile arborelui vor fi mai mici sau egale cu 1.000.000

                                                              ^
countsub.cpp:18:1: error: stray '\342' in program
 1 ≤ k ≤ 1000

 ^
countsub.cpp:18:1: error: stray '\211' in program
countsub.cpp:18:1: error: stray '\244' in program
countsub.cpp:18:1: error: stray '\342' in program
countsub.cpp:18:1: error: stray '\211' in program
countsub.cpp:18:1: error: stray '\244' in program
countsub.cpp:40:1: error: stray '\310' in program
 Explicație

 ^
countsub.cpp:40:1: error: stray '\233' in program
countsub.cpp:41:1: error: stray '\303' in program
 Exemplul corespunde arborelui de mai jos, în care au fost marcate cu albastru valorile din noduri, iar cu roșu numerele de ordine ale nodurilor.

 ^
countsub.cpp:41:1: error: stray '\256' in program
countsub.cpp:41:1: error: stray '\310' in program
countsub.cpp:41:1: error: stray '\231' in program
countsub.cpp:2:1: error: 'Problema' does not name a type
 Problema #674 – CountSub – Rezolvari PBInfo

 ^
countsub.cpp:8:138: error: 'linia' does not name a type
 Fișierul de intrare countsub.in conține pe prima linie numărul n. Fiecare dintre următoarele n linii contine câte 3 numere X st dr; linia i + 1 din fișier conține informatiile despre nodul numerotat cu i: X reprezintă valoare din nod, st reprezintă numărul de ordine al descendentului stâng sau 0 dacă nodul i nu are descendent stâng, iar dr reprezintă numărul de ordine al descendentului drept sau 0 dacă nodul i nu are descendent drept.

                                                                                                                                          ^
countsub.cpp:13:56: error: 'fiecare' does not name a type
 Fișierul de ieșire countsub.out va conține k linii; fiecare linie va conține numărul de noduri din subarborele cu rădăcina în nodul corespunzător.

                                                        ^
countsub.cpp: In function 'int main()':
countsub.cpp:61:5: error: reference to 'cin' is ambiguous
     cin >> n;

     ^
countsub.cpp:47:10: note: candidates are: std::ifstream cin
 ifstream cin("countsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countsub.cpp:45:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countsub.cpp:64:9: error: reference to 'cin' is ambiguous
         cin >> val[i] >> St[i] >> Dr[i];

         ^
countsub.cpp:47:10: note: candidates are: std::ifstream cin
 ifstream cin("countsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countsub.cpp:45:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countsub.cpp:68:5: error: reference to 'cin' is ambiguous
     cin >> k;

     ^
countsub.cpp:47:10: note: candidates are: std::ifstream cin
 ifstream cin("countsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countsub.cpp:45:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countsub.cpp:71:9: error: reference to 'cin' is ambiguous
         cin >> x;

         ^
countsub.cpp:47:10: note: candidates are: std::ifstream cin
 ifstream cin("countsub.in");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countsub.cpp:45:
/usr/include/c++/4.8/iostream:60:18: note:                 std::istream std::cin
   extern istream cin;  /// Linked to standard input
                  ^
countsub.cpp:74:9: error: reference to 'cout' is ambiguous
         cout << cnt << '\n';

         ^
countsub.cpp:48:10: note: candidates are: std::ofstream cout
 ofstream cout("countsub.out");

          ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0,
                 from countsub.cpp:45:
/usr/include/c++/4.8/iostream:61:18: note:                 std::ostream std::cout
   extern ostream cout;  /// Linked to standard output
                  ^

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