Detalii evaluare #63913257

Rezumat problemă

Gigel vrea să confecţioneze un ornament pentru pomul de iarnă format din pătrăţele frumos colorate. Pătrăţelele pot arăta ca în desenul alăturat. Se observă faptul că ele pot avea 4 culori diferite pe cele 4 laturi, 3, 2 sau chiar o singură culoare pe toate cele 4 laturi ale pătrăţelului.

Gigel are la dispoziţie n (n pătrat perfect) pătrăţele egale de acest tip cu laturile colorate doar în patru culori (alb, roşu, galben, albastru). Le vom numerota simplu de la 1 la 4.

Să se scrie un program care primeşte o listă de n pătrăţele colorate şi determină o aranjare a lor sub forma de pătrat de forma k•k (k•k = n) astfel încât două laturi adiacente să aibă aceeaşi culoare, precum şi numărul de astfel de aranjări.

Olimpiada Municipala Informatica Iasi 2015
Fișiere Peticaru Alexandru (AlexandruPeticaru) Marinel Serban concurs

Detalii

Problema Ornament Operații I/O ornament.in/ornament.out
Limita timp 0.2 secunde Limita memorie Total: 2 MB / Stivă 1 MB
Id soluție #63913257 Utilizator Peter Tobias (PeterTobias)
Fișier ornament.cpp Dimensiune 5.83 KB
Data încărcării 26 Martie 2026, 10:17 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

ornament.cpp: In function 'int main()':
ornament.cpp:67:27: error: parameter declared 'auto'
     auto gen = [&](auto &&self, int col) -> void {

                           ^
ornament.cpp: In lambda function:
ornament.cpp:104:18: error: 'self' was not declared in this scope
             self(self, col + 1);

                  ^
ornament.cpp:104:31: error: 'self' was not declared in this scope
             self(self, col + 1);

                               ^
ornament.cpp:104:31: error: redeclaration of '<typeprefixerror>self'
ornament.cpp:104:18: note: previous declaration '<typeprefixerror>self'
             self(self, col + 1);

                  ^
ornament.cpp: In function 'int main()':
ornament.cpp:109:15: error: no match for call to '(main()::__lambda0) (main()::__lambda0&, int)'
     gen(gen, 0);

               ^
ornament.cpp:67:18: note: candidate is:
     auto gen = [&](auto &&self, int col) -> void {

                  ^
ornament.cpp:67:45: note: main()::__lambda0
     auto gen = [&](auto &&self, int col) -> void {

                                             ^
ornament.cpp:67:45: note:   candidate expects 1 argument, 2 provided
ornament.cpp:126:29: error: parameter declared 'auto'
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                             ^
ornament.cpp: In lambda function:
ornament.cpp:138:29: error: 'self' was not declared in this scope
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:138:72: error: 'self' was not declared in this scope
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                                                                        ^
ornament.cpp:138:72: error: redeclaration of '<typeprefixerror>self'
ornament.cpp:138:29: note: previous declaration '<typeprefixerror>self'
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:144:29: error: 'self' was not declared in this scope
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:144:72: error: 'self' was not declared in this scope
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                                                                        ^
ornament.cpp:144:72: error: redeclaration of '<typeprefixerror>self'
ornament.cpp:144:29: note: previous declaration '<typeprefixerror>self'
                 ans += self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp: In function 'int main()':
ornament.cpp:154:29: error: parameter declared 'auto'
     auto build = [&](auto &&self, int row, int prevSig, int state) -> bool {

                             ^
ornament.cpp: In lambda function:
ornament.cpp:160:71: error: no match for call to '(main()::__lambda2) (main()::__lambda2&, int, const short unsigned int&, int)'
                 if (solve(solve, row + 1, p.bottomSig, state - p.delta) == 0) continue;

                                                                       ^
ornament.cpp:126:20: note: candidate is:
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                    ^
ornament.cpp:126:85: note: main()::__lambda2
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                                                                                     ^
ornament.cpp:126:85: note:   candidate expects 3 arguments, 4 provided
ornament.cpp:162:29: error: 'self' was not declared in this scope
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:162:72: error: 'self' was not declared in this scope
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                                                                        ^
ornament.cpp:162:72: error: redeclaration of '<typeprefixerror>self'
ornament.cpp:162:29: note: previous declaration '<typeprefixerror>self'
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:168:71: error: no match for call to '(main()::__lambda2) (main()::__lambda2&, int, const short unsigned int&, int)'
                 if (solve(solve, row + 1, p.bottomSig, state - p.delta) == 0) continue;

                                                                       ^
ornament.cpp:126:20: note: candidate is:
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                    ^
ornament.cpp:126:85: note: main()::__lambda2
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                                                                                     ^
ornament.cpp:126:85: note:   candidate expects 3 arguments, 4 provided
ornament.cpp:170:29: error: 'self' was not declared in this scope
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp:170:72: error: 'self' was not declared in this scope
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                                                                        ^
ornament.cpp:170:72: error: redeclaration of '<typeprefixerror>self'
ornament.cpp:170:29: note: previous declaration '<typeprefixerror>self'
                 return self(self, row + 1, p.bottomSig, state - p.delta);

                             ^
ornament.cpp: In function 'int main()':
ornament.cpp:185:66: error: no match for call to '(main()::__lambda2) (main()::__lambda2&, int, int, int&)'
         unsigned long long cntSol = solve(solve, 0, -1, fullState);

                                                                  ^
ornament.cpp:126:20: note: candidate is:
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                    ^
ornament.cpp:126:85: note: main()::__lambda2
     auto solve = [&](auto &&self, int row, int prevSig, int state) -> unsigned long long {

                                                                                     ^
ornament.cpp:126:85: note:   candidate expects 3 arguments, 4 provided
ornament.cpp:188:38: error: no match for call to '(main()::__lambda3) (main()::__lambda3&, int, int, int&)'
         build(build, 0, -1, fullState);

                                      ^
ornament.cpp:154:20: note: candidate is:
     auto build = [&](auto &&self, int row, int prevSig, int state) -> bool {

                    ^
ornament.cpp:154:71: note: main()::__lambda3
     auto build = [&](auto &&self, int row, int prevSig, int state) -> bool {

                                                                       ^
ornament.cpp:154:71: note:   candidate expects 3 arguments, 4 provided

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