Submission #1115014

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11150142024-11-19 22:16:52AdamGSOlympic Bus (JOI20_ho_t4)C++17
0 / 100
1 ms504 KiB
#include<bits/stdc++.h>
#define para pair<int, int>
using namespace std;
const int inf = INT_MAX; //nieskończoność
//struktura, która będzie przechowywać wierchołki grafu
struct G{
vector <para > pol; //z jakim wierzchołkiem, waga
int odl = inf; //najkrótsza ścieżka od źródła (na początku nieskończoność)
}*wezel;
void dijkstra(int start)
{
int dystans, a, b;
wezel[start].odl = 0;
set <para > krawedzie; //odleglosc od źródła, ( -> b)
//dodanie wszystkich wag krawędzi oraz numery wierzchołków docelowych
for(int i=0; i<wezel[start].pol.size();i++)
krawedzie.insert({wezel[start].pol[i].second, wezel[start].pol[i].first});
//lub
// krawedzie.insert(make_pair(wezel[start].pol[i].second, wezel[start].pol[i].first));
while(!krawedzie.empty()) //dopóki w secie są jeszcze jakieś krawędzie do analizy
{
//pobranie najkrótszej ścieżki oraz wierzchołek, do którego ona prowadzi
dystans = krawedzie.begin()->first; //dystans
b = krawedzie.begin()->second; //wierzchołek
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ho_t4.cpp: In function 'void dijkstra(int)':
ho_t4.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i=0; i<wezel[start].pol.size();i++)
      |               ~^~~~~~~~~~~~~~~~~~~~~~~~
ho_t4.cpp:37:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for(int i=0; i<wezel[b].pol.size(); i++) //przeglądam wszysktie połączenia z wierzchołka b
      |                ~^~~~~~~~~~~~~~~~~~~~
ho_t4.cpp:15:15: warning: unused variable 'a' [-Wunused-variable]
   15 |  int dystans, a, b;
      |               ^
ho_t4.cpp: In function 'int main()':
ho_t4.cpp:72:4: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   72 |  if(i != start)
      |    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...