Detalii evaluare #49513560

Rezumat problemă

#1036 Parc1

Un parc de formă dreptunghiulară este format din zone pietonale şi piste de biciclete. Reprezentând harta parcului într-un sistem cartezian, cu coordonata colţului stânga-jos (0,0), pistele de biciclete sunt reprezentate prin dungi orizontale sau verticale colorate cu gri, iar zonele pietonale au culoarea albă, ca în figura din dreapta.

Vizitatorii parcului se pot plimba liber pe zonele pietonale în orice direcţie, însă pistele de biciclete se vor traversa, în linie dreaptă, paralel cu axele. În figura alăturată avem un parc de dimensiuni 10 x 8, cu piste de biciclete verticale între 2 şi 4 respectiv 5 şi 8, şi orizontale între 0 şi 1 respectiv între 2 şi 4. Gigel se află în punctul A(1,1) şi poate sa ajungă pe drumul cel mai scurt la prietenul lui, în punctul B(8,7) deplasându-se astfel: porneşte din punctul (1,1) şi parcurge un traseu format din segmente cu extremităţile în punctele de coordonate (1.5 , 2) (1.5, 4) (2 , 5) (4 , 5) (5 , 7) şi în final ajunge în punctul de coordonate (8 , 7).

Lungimea totală a drumului va fi aproximativ 11.4721359.

Cunoscând dimensiunile parcului, coordonatele lui Gigel, coordonatele prietenului lui şi poziţiile pistelor de biciclete, să se calculeze lungimea drumului minim şi numărul drumurilor distincte de lungime minimă.

OJI 2012, clasele XI, XII

Detalii

Problema Parc1 Operații I/O parc1.in/parc1.out
Limita timp 0.1 secunde Limita memorie Total: 32 MB / Stivă 8 MB
Id soluție #49513560 Utilizator Iordache Alexandru (Hackerul_Gogu)
Fișier parc1.cpp Dimensiune 1.30 KB
Data încărcării 05 Martie 2024, 13:04 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

parc1.cpp: In function 'int main()':
parc1.cpp:19:12: error: 'n' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

            ^
parc1.cpp:19:17: error: 'm' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

                 ^
parc1.cpp:19:22: error: 'xs' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

                      ^
parc1.cpp:19:28: error: 'ys' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

                            ^
parc1.cpp:19:34: error: 'xf' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

                                  ^
parc1.cpp:19:40: error: 'yf' was not declared in this scope
     cin >> n >> m >> xs >> ys >> xf >> yf >> m;

                                        ^
parc1.cpp:20:9: error: 'i' was not declared in this scope
     for(i = 1; i <= m; i++) {

         ^
parc1.cpp:21:16: error: 'x' was not declared in this scope
         cin >> x >> y;

                ^
parc1.cpp:21:21: error: 'y' was not declared in this scope
         cin >> x >> y;

                     ^
parc1.cpp:22:13: error: 'j' was not declared in this scope
         for(j = x; j <= y; j++)

             ^
parc1.cpp:23:13: error: 'col' was not declared in this scope
             col[j] = 1;

             ^
parc1.cpp:26:9: error: 'i' was not declared in this scope
     for(i = 1; i <= m; i++) {

         ^
parc1.cpp:27:16: error: 'x' was not declared in this scope
         cin >> x >> y;

                ^
parc1.cpp:27:21: error: 'y' was not declared in this scope
         cin >> x >> y;

                     ^
parc1.cpp:28:13: error: 'j' was not declared in this scope
         for(j = x; j <= y; j++)

             ^
parc1.cpp:29:13: error: 'lin' was not declared in this scope
             lin[j] = 1;

             ^
parc1.cpp:31:5: error: 'x' was not declared in this scope
     x = xs, y = ys;

     ^
parc1.cpp:31:13: error: 'y' was not declared in this scope
     x = xs, y = ys;

             ^
parc1.cpp:32:26: error: no matching function for call to 'std::priority_queue<planoru>::push(<brace-enclosed initializer list>)'
     q.push({xs, ys, 0, 0});

                          ^
parc1.cpp:32:26: note: candidates are:
In file included from /usr/include/c++/4.8/queue:64:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:85,
                 from parc1.cpp:1:
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const planoru&}'
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<planoru>::value_type&& {aka planoru&&}'
parc1.cpp:34:9: error: 't' was not declared in this scope
         t = q.top();

         ^
parc1.cpp:36:9: error: 'i' was not declared in this scope
         i = t.x, j = t.y;

         ^
parc1.cpp:36:18: error: 'j' was not declared in this scope
         i = t.x, j = t.y;

                  ^
parc1.cpp:37:13: error: 'col' was not declared in this scope
         if(!col[t.y] && !lin[t.x])  {

             ^
parc1.cpp:37:26: error: 'lin' was not declared in this scope
         if(!col[t.y] && !lin[t.x])  {

                          ^
parc1.cpp:39:45: error: 'dp' was not declared in this scope
                 if(t.j == 0 && t.s + diag < dp[i-1][j][1])

                                             ^
parc1.cpp:40:79: error: no matching function for call to 'std::priority_queue<planoru>::push(<brace-enclosed initializer list>)'
                     dp[i-1][j][1] = t.s + diag, q.push({i-1, j, 1, t.s + diag});

                                                                               ^
parc1.cpp:40:79: note: candidates are:
In file included from /usr/include/c++/4.8/queue:64:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:85,
                 from parc1.cpp:1:
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const planoru&}'
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<planoru>::value_type&& {aka planoru&&}'
parc1.cpp:42:87: error: no matching function for call to 'std::priority_queue<planoru>::push(<brace-enclosed initializer list>)'
                     dp[i-1][j + 1][0] = t.s + diag, q.push({i-1, j + 1, 0, t.s + diag});

                                                                                       ^
parc1.cpp:42:87: note: candidates are:
In file included from /usr/include/c++/4.8/queue:64:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:85,
                 from parc1.cpp:1:
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const planoru&}'
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = planoru; _Sequence = std::vector<planoru, std::allocator<planoru> >; _Compare = std::less<planoru>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = planoru]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<planoru>::value_type&& {aka planoru&&}'
parc1.cpp:45:24: error: 'dp' was not declared in this scope
         if(xf < t.x && dp[i-1][j][t.j] > t.s + 1)

                        ^
parc1.cpp:49:5: error: expected primary-expression before '}' token
     }

     ^
parc1.cpp:49:5: error: expected ';' before '}' token
parc1.cpp:16:36: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("suma5.in", "r", stdin);

                                    ^
parc1.cpp:17:38: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("suma5.out", "w", stdout);

                                      ^

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