Borderou de evaluare (job #3292688)

Utilizator Luca_georgescuLucageorgescu Luca_georgescu Data 8 aprilie 2025 23:14:36
Problema Algoritmul lui Dijkstra Status done
Runda Arhiva educationala Compilator cpp-64 | Vezi sursa
Scor 0

Raport evaluator

Eroare de compilare: main.cpp:15:13: error: conflicting declaration 'std::vector<std::pair<int, int> > g [1005]' 15 | vector <pi> g[1005]; | ^ main.cpp:8:10: note: previous declaration as 'std::ofstream g' 8 | ofstream g("dijkstra.out"); | ^ main.cpp: In function 'void dijkstra(int)': main.cpp:37:18: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 37 | for (auto i:g[p] ) | ^ main.cpp:59:22: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 59 | for (auto i:g[k] ) | ^ main.cpp:63:23: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(<brace-enclosed initializer list>)' 63 | q.push({c+i.fs,i.sc}); | ~~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/12.2.1/queue:64, from /usr/include/c++/12.2.1/x86_64-pc-linux-gnu/bits/stdc++.h:86, from main.cpp:1: /usr/include/c++/12.2.1/bits/stl_queue.h:738:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]' 738 | push(const value_type& __x) | ^~~~ /usr/include/c++/12.2.1/bits/stl_queue.h:738:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&' {aka 'const std::pair<int, int>&'} 738 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/12.2.1/bits/stl_queue.h:746:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; value_type = std::pair<int, int>]' 746 | push(value_type&& __x) | ^~~~ /usr/include/c++/12.2.1/bits/stl_queue.h:746:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::value_type&&' {aka 'std::pair<int, int>&&'} 746 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ main.cpp: In function 'int main()': main.cpp:77:10: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 77 | g[x].push_back({c,y}); | ^ Non zero exit status: 1

Ceva nu functioneaza?