#146
Călinuţa tocmai a găsit o foaie de hârtie pe care este desenat un graf orientat aciclic cu N noduri şi M arce, fiecare arc având o distanţă de valoare întreagă. Dându-se N, M şi cele M arce cu distanţele dintre ele, trebuie să calculaţi pentru Călinuţa distanţa minimă dintre fiecare două noduri.
Grigore Moisil 2013
| Problema | graph | Operații I/O |
graph.in/graph.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64011817 | Utilizator | |
| Fișier | graph.cpp | Dimensiune | 1.97 KB |
| Data încărcării | 05 Aprilie 2026, 14:08 | Scor/rezultat | Eroare de compilare |
graph.cpp:17:11: warning: missing terminating " character [enabled by default] scanf("%d %d ^ graph.cpp:17:5: error: missing terminating " character scanf("%d %d ^ graph.cpp:18:1: warning: missing terminating " character [enabled by default] ", &n, &m); ^ graph.cpp:18:1: error: missing terminating " character graph.cpp: In function 'void read()': graph.cpp:19:5: error: expected primary-expression before 'for' for (int i = 0; i < m; ++i) { ^ graph.cpp:19:21: error: 'i' was not declared in this scope for (int i = 0; i < m; ++i) { ^ graph.cpp:19:31: error: expected ';' before ')' token for (int i = 0; i < m; ++i) { ^ graph.cpp: In function 'void sort()': graph.cpp:48:9: error: reference to 'hash' is ambiguous hash[node] = i; ^ graph.cpp:13:5: note: candidates are: int hash [1513] int hash[nMax]; ^ In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0, from /usr/include/c++/4.8/vector:65, from graph.cpp:4: /usr/include/c++/4.8/bits/functional_hash.h:58:12: note: template<class _Tp> struct std::hash struct hash; ^ graph.cpp: In function 'void solve()': graph.cpp:57:22: error: reference to 'hash' is ambiguous for (int j = hash[i+1]; j < n; ++j) { ^ graph.cpp:13:5: note: candidates are: int hash [1513] int hash[nMax]; ^ In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0, from /usr/include/c++/4.8/vector:65, from graph.cpp:4: /usr/include/c++/4.8/bits/functional_hash.h:58:12: note: template<class _Tp> struct std::hash struct hash; ^ In file included from /usr/include/c++/4.8/cassert:43:0, from graph.cpp:3: graph.cpp:63:27: error: reference to 'hash' is ambiguous assert(j < hash[v[node][k].first]); ^ graph.cpp:13:5: note: candidates are: int hash [1513] int hash[nMax]; ^ In file included from /usr/include/c++/4.8/bits/stl_bvector.h:1134:0, from /usr/include/c++/4.8/vector:65, from graph.cpp:4: /usr/include/c++/4.8/bits/functional_hash.h:58:12: note: template<class _Tp> struct std::hash struct hash; ^ graph.cpp: In function 'int main()': graph.cpp:78:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen(infile, "r", stdin); ^ graph.cpp:79:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen(outfile, "w", stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema graph 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ă.