Detalii evaluare #42431372

Rezumat problemă

Arhipelagul Zopopan este format din n insule de formă triunghiulară numerotate de la 1 la n. Fiecare insulă este localizată prin coordonatele carteziene ale vârfurilor.

Administrația dorește să cumpere elicoptere pentru a realiza transportul între insule. Un elicopter va putea să asigure o rută între două insule pe distanța minimă obținută pe orizontală sau verticală (paralel cu axele de coordonate). În plus, datorită capacității rezervorului o astfel de rută nu poate să depășească o valoare k – număr natural. Elicopterele parcurg rutele în ambele sensuri.
Investiția trebuie să îndeplinească următoarele condiții:

  1. Numărul de elicoptere cumpărate să fie minim.
  2. Numărul de perechi de insule între care se poate realiza transportul, folosind unul sau mai multe elicoptere să fie maxim.
  3. Suma lungimii tuturor rutelor să fie minimă.

Să se scrie un program care pentru n, k şi coordonatele vârfurilor insulelor cunoscute, determină:

  1. numărul minim de elicoptere ce vor fi cumpărate de administraţie;
  2. numărul perechilor neordonate de insule între care se poate realiza transportul prin elicoptere direct sau indirect;
  3. suma distantelor parcurse de toate elicopterele cumpărate (distanța parcursă de un elicopter se consideră distanța dintre insulele între care acesta asigură transportul).

Detalii

Problema Elicoptere Operații I/O elicoptere.in/elicoptere.out
Limita timp 0.2 secunde Limita memorie Total: 4 MB / Stivă 4 MB
Id soluție #42431372 Utilizator Necula Lois (Lois_Odette)
Fișier elicoptere.cpp Dimensiune 4.41 KB
Data încărcării 06 Martie 2023, 10:55 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

elicoptere.cpp:27:33: error: 'punc' has not been declared
 double disto (punct M, punct P, punc Q)

                                 ^
elicoptere.cpp: In function 'double disto(punct, punct, int)':
elicoptere.cpp:31:11: error: request for member 'x' in 'Q', which is of non-class type 'int'
     a = Q.x - P.y;

           ^
elicoptere.cpp:32:17: error: request for member 'x' in 'Q', which is of non-class type 'int'
     b = P.x - Q.x;

                 ^
elicoptere.cpp:33:17: error: request for member 'x' in 'Q', which is of non-class type 'int'
     c = P.y * Q.x - P.x * Q.y;

                 ^
elicoptere.cpp:33:29: error: request for member 'y' in 'Q', which is of non-class type 'int'
     c = P.y * Q.x - P.x * Q.y;

                             ^
elicoptere.cpp:34:32: error: request for member 'y' in 'Q', which is of non-class type 'int'
     if (M.y == P.y && P.y == Q.y)

                                ^
elicoptere.cpp:35:46: error: request for member 'x' in 'Q', which is of non-class type 'int'
         return minim(fabs(P.x - M.x), fabs(Q.x - M.x));

                                              ^
elicoptere.cpp:36:18: error: request for member 'y' in 'Q', which is of non-class type 'int'
     if (P.y == Q.y)

                  ^
elicoptere.cpp: At global scope:
elicoptere.cpp:42:33: error: 'punc' has not been declared
 double distv (punct M, punct P, punc Q)

                                 ^
elicoptere.cpp: In function 'double distv(punct, punct, int)':
elicoptere.cpp:46:11: error: request for member 'x' in 'Q', which is of non-class type 'int'
     a = Q.x - P.y;

           ^
elicoptere.cpp:47:17: error: request for member 'x' in 'Q', which is of non-class type 'int'
     b = P.x - Q.x;

                 ^
elicoptere.cpp:48:17: error: request for member 'x' in 'Q', which is of non-class type 'int'
     c = P.y * Q.x - P.x * Q.y;

                 ^
elicoptere.cpp:48:29: error: request for member 'y' in 'Q', which is of non-class type 'int'
     c = P.y * Q.x - P.x * Q.y;

                             ^
elicoptere.cpp:49:32: error: request for member 'x' in 'Q', which is of non-class type 'int'
     if (M.x == P.x && P.x == Q.x)

                                ^
elicoptere.cpp:50:46: error: request for member 'y' in 'Q', which is of non-class type 'int'
         return minim(fabs(P.y - M.y), fabs(Q.y - M.y));

                                              ^
elicoptere.cpp:51:18: error: request for member 'x' in 'Q', which is of non-class type 'int'
     if (P.x == Q.x)

                  ^
elicoptere.cpp: In function 'double distro(triunghi, triunghi)':
elicoptere.cpp:60:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.A,V.A,V.B);

                          ^
elicoptere.cpp:63:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.A,V.A,V.C);

                          ^
elicoptere.cpp:66:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.A,V.C,V.B);

                          ^
elicoptere.cpp:69:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.B,V.A,V.B);

                          ^
elicoptere.cpp:72:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.B,V.A,V.C);

                          ^
elicoptere.cpp:75:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.B,V.C,V.B);

                          ^
elicoptere.cpp:78:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.C,V.A,V.B);

                          ^
elicoptere.cpp:81:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.C,V.A,V.C);

                          ^
elicoptere.cpp:84:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double disto(punct, punct, int)'
     x = disto(W.C,V.C,V.B);

                          ^
elicoptere.cpp: In function 'double distrv(triunghi, triunghi)':
elicoptere.cpp:92:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.A,V.A,V.B);

                          ^
elicoptere.cpp:95:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.A,V.A,V.C);

                          ^
elicoptere.cpp:98:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.A,V.C,V.B);

                          ^
elicoptere.cpp:101:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.B,V.A,V.B);

                          ^
elicoptere.cpp:104:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.B,V.A,V.C);

                          ^
elicoptere.cpp:107:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.B,V.C,V.B);

                          ^
elicoptere.cpp:110:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.C,V.A,V.B);

                          ^
elicoptere.cpp:113:26: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
     x = distv(W.C,V.A,V.C);

                          ^
elicoptere.cpp:116:30: error: cannot convert 'punct' to 'int' for argument '3' to 'double distv(punct, punct, int)'
         x = distv(W.C,V.C,V.B);

                              ^
elicoptere.cpp: In function 'void matrice()':
elicoptere.cpp:136:17: error: 'a' was not declared in this scope
                 a[i][j] = a[j][i] = x;

                 ^
elicoptere.cpp:138:17: error: 'a' was not declared in this scope
                 a[i][j] = a[j][i] = inf;

                 ^
elicoptere.cpp: In function 'void bfs(int)':
elicoptere.cpp:143:5: error: 'b' was not declared in this scope
     b[nrc][0] = 1;

     ^
elicoptere.cpp:143:7: error: 'nrc' was not declared in this scope
     b[nrc][0] = 1;

       ^
elicoptere.cpp:145:5: error: 'viz' was not declared in this scope
     viz[x] = 1;

     ^
elicoptere.cpp:146:5: error: 'q' was not declared in this scope
     q.push(x);

     ^
elicoptere.cpp:152:28: error: 'a' was not declared in this scope
             if (!viz[i] && a[x][i] < inf)

                            ^
elicoptere.cpp: In function 'long long int perechi()':
elicoptere.cpp:165:14: error: 'viz' was not declared in this scope
         if (!viz[i])

              ^
elicoptere.cpp:167:12: error: 'nrc' was not declared in this scope
         ++ nrc;

            ^
elicoptere.cpp:169:21: error: 'b' was not declared in this scope
         nrp = nrp + b[nrc] * (b[nrc][0] - 1) / 2;

                     ^
elicoptere.cpp: In function 'void apm(int)':
elicoptere.cpp:176:5: error: 'x' was not declared in this scope
     x = b[q][1];

     ^
elicoptere.cpp:176:9: error: 'b' was not declared in this scope
     x = b[q][1];

         ^
elicoptere.cpp:181:9: error: 'cmin' was not declared in this scope
         cmin[b[q][i]] = a[x][b[q][i]];

         ^
elicoptere.cpp:181:25: error: 'a' was not declared in this scope
         cmin[b[q][i]] = a[x][b[q][i]];

                         ^
elicoptere.cpp:184:13: error: overloaded function with no contextual type information
         min = inf;

             ^
elicoptere.cpp:186:17: error: 'cmin' was not declared in this scope
             if (cmin[b[q][i]] < mi && s[b[q][i]] == 0)

                 ^
elicoptere.cpp:186:33: error: 'mi' was not declared in this scope
             if (cmin[b[q][i]] < mi && s[b[q][i]] == 0)

                                 ^
elicoptere.cpp:191:15: error: 'mi' was not declared in this scope
         ct += mi;

               ^
elicoptere.cpp:194:34: error: 'cmin' was not declared in this scope
             if(s[b[q][i] == 0 && cmin[b[q][i]] > a[x][b[q][i]])

                                  ^
elicoptere.cpp:194:50: error: 'a' was not declared in this scope
             if(s[b[q][i] == 0 && cmin[b[q][i]] > a[x][b[q][i]])

                                                  ^
elicoptere.cpp:194:63: error: expected ']' before ')' token
             if(s[b[q][i] == 0 && cmin[b[q][i]] > a[x][b[q][i]])

                                                               ^
elicoptere.cpp:197:12: error: 'mi' was not declared in this scope
     return mi;

            ^
elicoptere.cpp:197:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
elicoptere.cpp: In function 'int main()':
elicoptere.cpp:201:5: error: 'cout' was not declared in this scope
     cout << "Hello world!" << endl;

     ^

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