Detalii evaluare #61391910

Rezumat problemă

#2628

În urma referendumului a rămas doar un șir de numere naturale a[1], a[2], …, a[n]. Să se determine cel mai mic număr care apare exact o dată în șir.

Detalii

Problema h2 Operații I/O tastatură/ecran
Limita timp 0.9 secunde Limita memorie Total: 128 MB / Stivă 8 MB
Id soluție #61391910 Utilizator Dragoi David - Șmenul lui Tantza Uraganu (dL_Ezekiel_123)
Fișier h2.cpp Dimensiune 5.41 KB
Data încărcării 26 Noiembrie 2025, 13:24 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

h2.cpp:1:7: error: expected nested-name-specifier before 'System'
 using System;

       ^
h2.cpp:1:7: error: 'System' has not been declared
h2.cpp:2:7: error: expected nested-name-specifier before 'System'
 using System.Collections.Generic;

       ^
h2.cpp:2:7: error: 'System' has not been declared
h2.cpp:2:13: error: expected ';' before '.' token
 using System.Collections.Generic;

             ^
h2.cpp:2:13: error: expected unqualified-id before '.' token
h2.cpp:3:7: error: expected nested-name-specifier before 'System'
 using System.Linq;

       ^
h2.cpp:3:7: error: 'System' has not been declared
h2.cpp:3:13: error: expected ';' before '.' token
 using System.Linq;

             ^
h2.cpp:3:13: error: expected unqualified-id before '.' token
h2.cpp:4:7: error: expected nested-name-specifier before 'System'
 using System.Text;

       ^
h2.cpp:4:7: error: 'System' has not been declared
h2.cpp:4:13: error: expected ';' before '.' token
 using System.Text;

             ^
h2.cpp:4:13: error: expected unqualified-id before '.' token
h2.cpp:5:7: error: expected nested-name-specifier before 'System'
 using System.Threading.Tasks;

       ^
h2.cpp:5:7: error: 'System' has not been declared
h2.cpp:5:13: error: expected ';' before '.' token
 using System.Threading.Tasks;

             ^
h2.cpp:5:13: error: expected unqualified-id before '.' token
h2.cpp:11:16: error: expected ':' before 'string'
         public string val;

                ^
h2.cpp:11:16: error: 'string' does not name a type
h2.cpp:12:16: error: expected ':' before 'int'
         public int fr;

                ^
h2.cpp:13:16: error: expected ':' before 'Element'
         public Element(string x)

                ^
h2.cpp:13:31: error: expected ')' before 'x'
         public Element(string x)

                               ^
h2.cpp:18:5: error: expected ';' after class definition
     }

     ^
h2.cpp:22:17: error: expected ':' before 'int'
         private int P = 123457;

                 ^
h2.cpp:23:17: error: expected ':' before 'List'
         private List<Element>[] h;

                 ^
h2.cpp:23:17: error: 'List' does not name a type
h2.cpp:24:17: error: expected ':' before 'int'
         private int n;//nr de elemente distincte din hash

                 ^
h2.cpp:25:16: error: expected ':' before 'UnorderedMap'
         public UnorderedMap()

                ^
h2.cpp:32:16: error: expected ':' before 'int'
         public int Count // nr deelementedistincte din hash

                ^
h2.cpp:35:9: error: expected ';' at end of member declaration
         }

         ^
h2.cpp:36:16: error: expected ':' before 'void'
         public void Add(string x)

                ^
h2.cpp:36:25: error: 'string' has not been declared
         public void Add(string x)

                         ^
h2.cpp:55:16: error: expected ':' before 'void'
         public void Erase(string x)

                ^
h2.cpp:55:27: error: 'string' has not been declared
         public void Erase(string x)

                           ^
h2.cpp:74:16: error: expected ':' before 'void'
         public void EraseAll(string x)

                ^
h2.cpp:74:30: error: 'string' has not been declared
         public void EraseAll(string x)

                              ^
h2.cpp:87:16: error: expected ':' before 'void'
         public void Afis(int r)

                ^
h2.cpp:92:16: error: expected ':' before 'void'
         public void Afis()

                ^
h2.cpp:102:16: error: expected ':' before 'Element'
         public Element FrecvMax()

                ^
h2.cpp:112:16: error: expected ':' before 'int'
         public int F()

                ^
h2.cpp:126:16: error: expected ':' before 'int'
         public int this[string x]

                ^
h2.cpp:126:20: error: expected unqualified-id before 'this'
         public int this[string x]

                    ^
h2.cpp:183:1: error: expected '}' at end of input
 }

 ^
h2.cpp:34:13: error: 'get' was not declared in this scope
             get { return n; }

             ^
h2.cpp:34:17: error: expected '}' before '{' token
             get { return n; }

                 ^
h2.cpp:34:17: error: cannot convert '<brace-enclosed initializer list>' to 'int' in initialization
h2.cpp:34:17: error: expected ';' before '{' token
h2.cpp: In constructor 'p33_UnorderedMap::UnorderedMap::UnorderedMap()':
h2.cpp:27:13: error: 'h' was not declared in this scope
             h = new List<Element>[P];

             ^
h2.cpp:27:21: error: expected type-specifier before 'List'
             h = new List<Element>[P];

                     ^
h2.cpp:27:21: error: expected ';' before 'List'
h2.cpp:29:28: error: expected type-specifier before 'List'
                 h[i] = new List<Element>();

                            ^
h2.cpp:29:28: error: expected ';' before 'List'
h2.cpp: In member function 'void p33_UnorderedMap::UnorderedMap::Add(int)':
h2.cpp:39:22: error: expected primary-expression before 'char'
             foreach (char ch in x)

                      ^
h2.cpp:39:34: error: 'foreach' was not declared in this scope
             foreach (char ch in x)

                                  ^
h2.cpp:40:17: error: expected ';' before 'r'
                 r = (256 * r + (int)ch) % P;

                 ^
h2.cpp:43:29: error: 'h' was not declared in this scope
             for (i = 0; i < h[r].Count; i++)

                             ^
h2.cpp:49:38: error: no matching function for call to 'p33_UnorderedMap::Element::Element(int&)'
             Element e = new Element(x);

                                      ^
h2.cpp:49:38: note: candidates are:
h2.cpp:9:11: note: p33_UnorderedMap::Element::Element()
     class Element

           ^
h2.cpp:9:11: note:   candidate expects 0 arguments, 1 provided
h2.cpp:9:11: note: constexpr p33_UnorderedMap::Element::Element(const p33_UnorderedMap::Element&)
h2.cpp:9:11: note:   no known conversion for argument 1 from 'int' to 'const p33_UnorderedMap::Element&'
h2.cpp:9:11: note: constexpr p33_UnorderedMap::Element::Element(p33_UnorderedMap::Element&&)
h2.cpp:9:11: note:   no known conversion for argument 1 from 'int' to 'p33_UnorderedMap::Element&&'
h2.cpp:50:13: error: 'h' was not declared in this scope
             h[r].Add(e);

             ^
h2.cpp: In member function 'void p33_UnorderedMap::UnorderedMap::Erase(int)':
h2.cpp:58:22: error: expected primary-expression before 'char'
             foreach (char ch in x)

                      ^
h2.cpp:58:34: error: 'foreach' was not declared in this scope
             foreach (char ch in x)

                                  ^
h2.cpp:59:17: error: expected ';' before 'r'
                 r = (256 * r + (int)ch) % P;

                 ^
h2.cpp:62:29: error: 'h' was not declared in this scope
             for (i = 0; i < h[r].Count; i++)

                             ^
h2.cpp: In member function 'void p33_UnorderedMap::UnorderedMap::EraseAll(int)':
h2.cpp:77:22: error: expected primary-expression before 'char'
             foreach (char ch in x)

                      ^
h2.cpp:77:34: error: 'foreach' was not declared in this scope
             foreach (char ch in x)

                                  ^
h2.cpp:78:17: error: expected ';' before 'r'
                 r = (256 * r + (int)ch) % P;

                 ^
h2.cpp:79:29: error: 'h' was not declared in this scope
             for (i = 0; i < h[r].Count; i++)

                             ^
h2.cpp: In member function 'void p33_UnorderedMap::UnorderedMap::Afis(int)':
h2.cpp:89:30: error: expected primary-expression before 'e'
             foreach (Element e in h[r])

                              ^
h2.cpp:89:39: error: 'foreach' was not declared in this scope
             foreach (Element e in h[r])

                                       ^
h2.cpp:90:17: error: expected ';' before 'Console'
                 Console.Write(e.val + " ");

                 ^
h2.cpp: In member function 'void p33_UnorderedMap::UnorderedMap::Afis()':
h2.cpp:95:21: error: 'h' was not declared in this scope
                 if (h[i].Count > 0)

                     ^
h2.cpp:98:21: error: 'Console' was not declared in this scope
                     Console.WriteLine();

                     ^
h2.cpp: In member function 'p33_UnorderedMap::Element p33_UnorderedMap::UnorderedMap::FrecvMax()':
h2.cpp:104:58: error: no matching function for call to 'p33_UnorderedMap::Element::Element(const char [20])'
             Element e = new Element("zzzzzzzzzzzzzzzzzzz");

                                                          ^
h2.cpp:104:58: note: candidates are:
h2.cpp:9:11: note: p33_UnorderedMap::Element::Element()
     class Element

           ^
h2.cpp:9:11: note:   candidate expects 0 arguments, 1 provided
h2.cpp:9:11: note: constexpr p33_UnorderedMap::Element::Element(const p33_UnorderedMap::Element&)
h2.cpp:9:11: note:   no known conversion for argument 1 from 'const char [20]' to 'const p33_UnorderedMap::Element&'
h2.cpp:9:11: note: constexpr p33_UnorderedMap::Element::Element(p33_UnorderedMap::Element&&)
h2.cpp:9:11: note:   no known conversion for argument 1 from 'const char [20]' to 'p33_UnorderedMap::Element&&'
h2.cpp:107:21: error: 'h' was not declared in this scope
                 if (h[i].Count > 0)

                     ^
h2.cpp:108:38: error: expected primary-expression before 'w'
                     foreach (Element w in h[i])

                                      ^
h2.cpp:108:47: error: 'foreach' was not declared in this scope
                     foreach (Element w in h[i])

                                               ^
h2.cpp:109:25: error: expected ';' before 'if'
                         if ((w.fr > e.fr) || (w.fr == e.fr && w.val.CompareTo(e.val) < 0)) e = w;

                         ^
h2.cpp: In member function 'int p33_UnorderedMap::UnorderedMap::F()':
h2.cpp:116:21: error: 'h' was not declared in this scope
                 if (h[i].Count > 0)

                     ^
h2.cpp:117:38: error: expected primary-expression before 'w'
                     foreach (Element w in h[i])

                                      ^
h2.cpp:117:47: error: 'foreach' was not declared in this scope
                     foreach (Element w in h[i])

                                               ^
h2.cpp:118:25: error: expected ';' before 'if'
                         if (w.fr == 1)

                         ^
h2.cpp:114:17: warning: unused variable 'x' [-Wunused-variable]
             int x, valmin = 2000000001;

                 ^
h2.cpp: At global scope:
h2.cpp:124:9: error: expected unqualified-id at end of input
         }

         ^
h2.cpp:124:9: error: expected '}' at end of input

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 h2 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!