Detalii evaluare #58017982

Rezumat problemă

Alina, managerul unui lanț de magazine, este responsabilă de gestiunea tranzacțiilor bancare din cadrul acestora. Ea lucrează cu conturi bancare și cunoaște sumele de bani (soldul) existente în fiecare dintre acestea. Se cunosc N, numărul tranzacțiilor și N numere întregi nenule a[1], a[2], …, a[N], reprezentând, în această ordine, sumele de tranzacționat (un număr pozitiv indică o sumă care urmează a fi depusă, iar un număr negativ reprezintă o sumă care urmează a fi retrasă). După procesarea celor N tranzacții, ajutați-o pe Alina să determine:
1) numărul de conturi rămase active.
2) soldul maxim care se găsește într-un cont dintre cele rămase active.

ONI 2025, clasa a 7-a

Fișiere Pracsiu Dan (dnprx) Raluca Costineanu concurs

Detalii

Problema conturi1 Operații I/O conturi.in/conturi.out
Limita timp 1 secunde Limita memorie Total: 32 MB / Stivă 8 MB
Id soluție #58017982 Utilizator Raia Eric (EricSquirtle)
Fișier conturi1.cpp Dimensiune 1.94 KB
Data încărcării 08 Mai 2025, 15:37 Scor / rezultat Eroare de compilare

Evaluare

Mesaj compilare

conturi1.cpp:3:13: error: expected unqualified-id before '__int128'
 #define int __int128

             ^
conturi1.cpp:12:5: note: in expansion of macro 'int'
     int s,l,c;

     ^
conturi1.cpp: In member function 'bool comp1::operator()(const Cont&, const Cont&) const':
conturi1.cpp:19:18: error: 'const struct Cont' has no member named 'l'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                  ^
conturi1.cpp:19:24: error: 'const struct Cont' has no member named 'l'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                        ^
conturi1.cpp:19:31: error: 'const struct Cont' has no member named 'l'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                               ^
conturi1.cpp:19:38: error: 'const struct Cont' has no member named 'l'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                      ^
conturi1.cpp:19:46: error: 'const struct Cont' has no member named 's'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                              ^
conturi1.cpp:19:52: error: 'const struct Cont' has no member named 's'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                                    ^
conturi1.cpp:19:59: error: 'const struct Cont' has no member named 's'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                                           ^
conturi1.cpp:19:66: error: 'const struct Cont' has no member named 's'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                                                  ^
conturi1.cpp:19:73: error: 'const struct Cont' has no member named 'c'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                                                         ^
conturi1.cpp:19:79: error: 'const struct Cont' has no member named 'c'
         return a.l > b.l || a.l == b.l && (a.s > b.s || a.s == b.s && a.c < b.c);

                                                                               ^
conturi1.cpp: In member function 'bool comp2::operator()(const Cont&, const Cont&) const':
conturi1.cpp:27:18: error: 'const struct Cont' has no member named 's'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                  ^
conturi1.cpp:27:24: error: 'const struct Cont' has no member named 's'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                        ^
conturi1.cpp:27:31: error: 'const struct Cont' has no member named 's'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                               ^
conturi1.cpp:27:38: error: 'const struct Cont' has no member named 's'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                      ^
conturi1.cpp:27:46: error: 'const struct Cont' has no member named 'l'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                              ^
conturi1.cpp:27:52: error: 'const struct Cont' has no member named 'l'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                                    ^
conturi1.cpp:27:59: error: 'const struct Cont' has no member named 'l'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                                           ^
conturi1.cpp:27:66: error: 'const struct Cont' has no member named 'l'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                                                  ^
conturi1.cpp:27:73: error: 'const struct Cont' has no member named 'c'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                                                         ^
conturi1.cpp:27:79: error: 'const struct Cont' has no member named 'c'
         return a.s < b.s || a.s == b.s && (a.l > b.l || a.l == b.l && a.c < b.c);

                                                                               ^
conturi1.cpp: At global scope:
conturi1.cpp:3:13: error: expected unqualified-id before '__int128'
 #define int __int128

             ^
conturi1.cpp:33:1: note: in expansion of macro 'int'
 int idx = 1;

 ^
conturi1.cpp: In function 'int main()':
conturi1.cpp:3:13: error: expected primary-expression before '__int128'
 #define int __int128

             ^
conturi1.cpp:53:9: note: in expansion of macro 'int'
     for(int i=1; i<=n; ++i){

         ^
conturi1.cpp:3:13: error: expected ';' before '__int128'
 #define int __int128

             ^
conturi1.cpp:53:9: note: in expansion of macro 'int'
     for(int i=1; i<=n; ++i){

         ^
conturi1.cpp:53:18: error: 'i' was not declared in this scope
     for(int i=1; i<=n; ++i){

                  ^
conturi1.cpp:3:13: error: expected primary-expression before '__int128'
 #define int __int128

             ^
conturi1.cpp:54:9: note: in expansion of macro 'int'
         int x;

         ^
conturi1.cpp:3:13: error: expected ';' before '__int128'
 #define int __int128

             ^
conturi1.cpp:54:9: note: in expansion of macro 'int'
         int x;

         ^
conturi1.cpp:57:9: error: 'x' was not declared in this scope
         x = _x;

         ^
conturi1.cpp:59:45: error: 'const struct Cont' has no member named 'l'
             if(s1.empty() || s1.rbegin() -> l >= x){

                                             ^
conturi1.cpp:60:33: error: 'idx' was not declared in this scope
                 Cont cnt = {x,x,idx++};

                                 ^
conturi1.cpp:64:55: error: no matching function for call to 'std::set<Cont, comp1>::lower_bound(<brace-enclosed initializer list>)'
             Cont cnt = *s1.lower_bound({0,x,999999999});

                                                       ^
conturi1.cpp:64:55: note: candidates are:
In file included from /usr/include/c++/4.8/set:61:0,
                 from conturi1.cpp:2:
/usr/include/c++/4.8/bits/stl_set.h:683:7: note: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) [with _Key = Cont; _Compare = comp1; _Alloc = std::allocator<Cont>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<Cont>; std::set<_Key, _Compare, _Alloc>::key_type = Cont]
       lower_bound(const key_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_set.h:683:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const Cont&}'
/usr/include/c++/4.8/bits/stl_set.h:687:7: note: std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) const [with _Key = Cont; _Compare = comp1; _Alloc = std::allocator<Cont>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<Cont>; std::set<_Key, _Compare, _Alloc>::key_type = Cont]
       lower_bound(const key_type& __x) const
       ^
/usr/include/c++/4.8/bits/stl_set.h:687:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const key_type& {aka const Cont&}'
conturi1.cpp:66:17: error: 'struct Cont' has no member named 'l'
             cnt.l = x;

                 ^
conturi1.cpp:67:17: error: 'struct Cont' has no member named 's'
             cnt.s += x;

                 ^
conturi1.cpp:75:24: error: 'struct Cont' has no member named 's'
                 if(cnt.s >= x){

                        ^
conturi1.cpp:76:25: error: 'struct Cont' has no member named 's'
                     cnt.s -= x;

                         ^
conturi1.cpp:80:30: error: 'struct Cont' has no member named 's'
                     x -= cnt.s;

                              ^
conturi1.cpp:81:25: error: 'struct Cont' has no member named 's'
                     cnt.s = 0;

                         ^
conturi1.cpp:83:24: error: 'struct Cont' has no member named 's'
                 if(cnt.s)

                        ^
conturi1.cpp:3:13: error: expected primary-expression before '__int128'
 #define int __int128

             ^
conturi1.cpp:91:9: note: in expansion of macro 'int'
         int C = 1000000000000000000LL;

         ^
conturi1.cpp:3:13: error: expected ';' before '__int128'
 #define int __int128

             ^
conturi1.cpp:91:9: note: in expansion of macro 'int'
         int C = 1000000000000000000LL;

         ^
conturi1.cpp:92:27: error: 'const struct Cont' has no member named 's'
         if(s2.rbegin() -> s >= C)

                           ^
conturi1.cpp:92:32: error: 'C' was not declared in this scope
         if(s2.rbegin() -> s >= C)

                                ^
conturi1.cpp:93:46: error: 'const struct Cont' has no member named 's'
             cout<<(long long)(s2.rbegin() -> s / C);

                                              ^
conturi1.cpp:94:42: error: 'const struct Cont' has no member named 's'
         cout<<(long long)(s2.rbegin() -> s % C);

                                          ^
conturi1.cpp:94:46: error: 'C' was not declared in this scope
         cout<<(long long)(s2.rbegin() -> s % C);

                                              ^
conturi1.cpp: In member function 'bool comp1::operator()(const Cont&, const Cont&) const':
conturi1.cpp:20:5: warning: control reaches end of non-void function [-Wreturn-type]
     }

     ^
conturi1.cpp: In member function 'bool comp2::operator()(const Cont&, const Cont&) const':
conturi1.cpp:28:5: warning: control reaches end of non-void function [-Wreturn-type]
     }

     ^

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