#1622
Elicoptere
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:
Să se scrie un program care pentru n
, k
şi coordonatele vârfurilor insulelor cunoscute, determină:
OJI 2016, Clasele XI-XII
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 | |
Fișier | elicoptere.cpp | Dimensiune | 4.41 KB |
Data încărcării | 06 Martie 2023, 10:55 | Scor / rezultat | Eroare de 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; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Elicoptere face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
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ă.