Submission #1073789

#TimeUsernameProblemLanguageResultExecution timeMemory
1073789OspleiStations (IOI20_stations)C++17
0 / 100
662 ms25304 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define pb push_back int pos = 0; vector <int> bfs (int n, int nodo, vector <int> grafo[1000005]){ vector <int> aux(n); bool visto[1000005]; queue <int> q; for (int i = 0; i < 1000005; i++) visto[i] = false; q.push(nodo); while (!q.empty()){ int act = q.front(); q.pop(); if (visto[act] == true) continue; visto[act] = true; for (auto i : grafo[act]) q.push(i); aux[act] = pos; pos++; } return aux; } vector <int> label(int n, int k, vector <int> u, vector <int> v) { vector <int> grafo[1000005]; for (int i = 0; i < u.size(); i++) { int a = u[i], b = v[i]; grafo[a].pb(b); grafo[b].pb(a); } for (int i = 0; i < n; i++){ if (grafo[i].size() == 1){ vector <int> labels = bfs(n, i, grafo); //for (auto j : labels) cout << j << " "; return labels; } } return u; } int find_next_station(int s, int t, vector <int> c) { if (c.size() == 1) return c[0]; if (t > s) return max(c[0], c[1]); else return min(c[0], c[1]); } /* int main(){ label(5, 10, {0, 3, 4, 2}, {1, 4, 0, 1}); } */

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:40:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       for (int i = 0; i < u.size(); i++) {
      |                       ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...