#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 | #42431559 | Utilizator | |
Fișier | elicoptere.cpp | Dimensiune | 4.68 KB |
Data încărcării | 06 Martie 2023, 11:03 | Scor / rezultat | Eroare de compilare |
elicoptere.cpp: In function 'void citire()': elicoptere.cpp:17:10: error: 'cer' was not declared in this scope f >> cer >> n >> k; ^ elicoptere.cpp:17:17: error: 'n' was not declared in this scope f >> cer >> n >> k; ^ elicoptere.cpp:17:22: error: 'k' was not declared in this scope f >> cer >> n >> k; ^ elicoptere.cpp:18:10: error: 'i' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp: At global scope: elicoptere.cpp:28: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:32:11: error: request for member 'x' in 'Q', which is of non-class type 'int' a = Q.x - P.y; ^ elicoptere.cpp:33:17: error: request for member 'x' in 'Q', which is of non-class type 'int' b = P.x - Q.x; ^ elicoptere.cpp:34: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:34: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:35: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:36: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:37: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:43: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:47:11: error: request for member 'x' in 'Q', which is of non-class type 'int' a = Q.x - P.y; ^ elicoptere.cpp:48:17: error: request for member 'x' in 'Q', which is of non-class type 'int' b = P.x - Q.x; ^ elicoptere.cpp:49: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:49: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:50: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:51: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:52: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:61: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:64: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:67: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:70: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:73: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:76: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:79: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:82: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:85: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:93: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:96: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:99: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:102: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:105: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:108: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:111: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:114: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:117: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:126:22: error: 'n' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp:136:22: error: 'k' was not declared in this scope if (x <= k) ^ elicoptere.cpp:137:17: error: 'a' was not declared in this scope a[i][j] = a[j][i] = x; ^ elicoptere.cpp:139: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:144:5: error: 'b' was not declared in this scope b[nrc][0] = 1; ^ elicoptere.cpp:144:7: error: 'nrc' was not declared in this scope b[nrc][0] = 1; ^ elicoptere.cpp:146:5: error: 'viz' was not declared in this scope viz[x] = 1; ^ elicoptere.cpp:147:5: error: 'q' was not declared in this scope q.push(x); ^ elicoptere.cpp:152:14: error: 'i' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp:152:26: error: 'n' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp:153: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:10: error: 'i' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp:165:22: error: 'n' was not declared in this scope for (i = 1; i <= n; ++ i) ^ elicoptere.cpp:166:14: error: 'viz' was not declared in this scope if (!viz[i]) ^ elicoptere.cpp:168:12: error: 'nrc' was not declared in this scope ++ nrc; ^ elicoptere.cpp:170: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:177:5: error: 'x' was not declared in this scope x = b[q][1]; ^ elicoptere.cpp:177:9: error: 'b' was not declared in this scope x = b[q][1]; ^ elicoptere.cpp:179:10: error: 'i' was not declared in this scope for (i = 2; i <= b[q][0]; ++ i) ^ elicoptere.cpp:181:10: error: 'i' was not declared in this scope for (i = 1; i <= b[q][0]; ++ i) ^ elicoptere.cpp:182:9: error: 'cmin' was not declared in this scope cmin[b[q][i]] = a[x][b[q][i]]; ^ elicoptere.cpp:182:25: error: 'a' was not declared in this scope cmin[b[q][i]] = a[x][b[q][i]]; ^ elicoptere.cpp:183:10: error: 'j' was not declared in this scope for (j = 1; j < b[q][0]; ++ j) ^ elicoptere.cpp:185:13: error: overloaded function with no contextual type information min = inf; ^ elicoptere.cpp:186:14: error: 'i' was not declared in this scope for (i = 1; i <= b[q][0]; ++ i) ^ elicoptere.cpp:187:17: error: 'cmin' was not declared in this scope if (cmin[b[q][i]] < mi && s[b[q][i]] == 0) ^ elicoptere.cpp:187:33: error: 'mi' was not declared in this scope if (cmin[b[q][i]] < mi && s[b[q][i]] == 0) ^ elicoptere.cpp:190:17: error: 'k' was not declared in this scope k = b[q][i]; ^ elicoptere.cpp:192:15: error: 'mi' was not declared in this scope ct += mi; ^ elicoptere.cpp:193:11: error: 'k' was not declared in this scope s[k] = 1; ^ elicoptere.cpp:194:14: error: 'i' was not declared in this scope for (i = 1; i < b[q][0]; ++ i) ^ elicoptere.cpp:195: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:195: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:195:63: error: expected ']' before ')' token if(s[b[q][i] == 0 && cmin[b[q][i]] > a[x][b[q][i]]) ^ elicoptere.cpp:198:12: error: 'mi' was not declared in this scope return mi; ^ elicoptere.cpp:198:12: error: return-statement with a value, in function returning 'void' [-fpermissive] elicoptere.cpp: In function 'int main()': elicoptere.cpp:205:9: error: 'cer' was not declared in this scope if (cer == 1) ^ elicoptere.cpp:206:14: error: 'nrc' was not declared in this scope g << nrc; ^ elicoptere.cpp:212:9: error: 'rez' was not declared in this scope rez = 0; ^ elicoptere.cpp:213:14: error: 'i' was not declared in this scope for (i = 1; i <= nrc; ++ i) ^ elicoptere.cpp:213:26: error: 'nrc' was not declared in this scope for (i = 1; i <= nrc; ++ i) ^
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ă.