#4078
Matei, care locuiește in orașul p
, vrea să ajungă in orașul q
să il viziteze. El are o hartă pe care se află n
orașe și m
drumuri prin care poate să treacă pentru a ajunge la destinație. Pe hartă apare și durata de timp td
pentru fiecare drum, care reprezintă numărul de minute în care este parcurs drumul și to
pentru traversarea orașelor (unele orașe sunt mai aglomerate, iar altele nu). Matei vrea să ajungă cat mai rapid la destinație, dar dacă există mai multe trasee de timp minim, il va alege pe acela care trece prin mai multe orașe. Nu vor exista trasee de timp minim cu același număr de orașe. Ajutati-l pe Matei să gasească drumul cerut.
Problema | Distanta | Operații I/O |
![]() distanta.in /distanta.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56966189 | Utilizator | |
Fișier | distanta.cpp | Dimensiune | 1.20 KB |
Data încărcării | 11 Martie 2025, 22:33 | Scor / rezultat | Eroare de compilare |
distanta.cpp:7:25: error: conflicting declaration 'char a' char nume_oras[22][22], a, b; ^ distanta.cpp:6:5: error: 'a' has a previous declaration as 'int a [22][22]' int a[22][22], timp[22], to[22], atd[191][191], n, m, x, y, p, q; ^ distanta.cpp: In function 'int main()': distanta.cpp:13:10: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' cin>>a; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from distanta.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [22][22]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ distanta.cpp:14:27: error: cannot convert 'int (*)[22]' to 'char*' for argument '1' to 'char* strcpy(char*, const char*)' strcpy(a, nume_oras[i]); ^ distanta.cpp:20:11: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' cin>>a>>b; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from distanta.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [22][22]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ distanta.cpp:23:35: error: cannot convert 'int (*)[22]' to 'const char*' for argument '2' to 'int strcmp(const char*, const char*)' if( strcmp(nume_oras[i],a)) xa=i; ^ distanta.cpp:24:35: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(nume_oras[i], b)) xb=i; ^ In file included from /usr/include/c++/4.8/cstring:42:0, from distanta.cpp:2: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ distanta.cpp:24:38: error: 'xb' was not declared in this scope if(strcmp(nume_oras[i], b)) xb=i; ^ distanta.cpp:27:15: error: 'xb' was not declared in this scope a[xa][xb]=a[xb][xa]=1; ^ distanta.cpp:28:14: error: 'td' was not declared in this scope cin>>td; ^ distanta.cpp:21:17: warning: unused variable 'yb' [-Wunused-variable] int xa, yb; ^ distanta.cpp:31:10: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' cin>>a>>b; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from distanta.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [22][22]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ distanta.cpp:33:35: error: cannot convert 'int (*)[22]' to 'const char*' for argument '2' to 'int strcmp(const char*, const char*)' if( strcmp(nume_oras[i],a)) xa=i; ^ distanta.cpp:33:38: error: 'xa' was not declared in this scope if( strcmp(nume_oras[i],a)) xa=i; ^ distanta.cpp:34:35: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if(strcmp(nume_oras[i], b)) xb=i; ^ In file included from /usr/include/c++/4.8/cstring:42:0, from distanta.cpp:2: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ distanta.cpp:34:38: error: 'xb' was not declared in this scope if(strcmp(nume_oras[i], b)) xb=i; ^ distanta.cpp:37:8: error: 'xa' was not declared in this scope p = xa; ^ distanta.cpp:38:9: error: 'xb' was not declared in this scope q = xb; ^ distanta.cpp:53:1: error: expected ';' before '}' token } ^ distanta.cpp:53:1: error: expected primary-expression before '}' token distanta.cpp:53:1: error: expected ';' before '}' token distanta.cpp:53:1: error: expected primary-expression before '}' token distanta.cpp:53:1: error: expected ')' before '}' token distanta.cpp:53:1: error: expected primary-expression before '}' token distanta.cpp:53:1: error: expected ';' before '}' token distanta.cpp:51:13: warning: unused variable 'i' [-Wunused-variable] for(int i = 1 ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Distanta 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ă.