Submission #306975

#TimeUsernameProblemLanguageResultExecution timeMemory
306975giorgikobStations (IOI20_stations)C++14
0 / 100
861 ms1040 KiB
#include "stations.h" #include <vector> #include<bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; const int N = 1e3+5; vector<int>gr[N]; int cnt = 0; int fix[N]; int mn[N]; //int c = 0; void dfs(int x, vector<int>&v){ fix[x] = 1; v[x] = cnt; cnt++; for(auto to : gr[x]){ if(fix[to]) continue; dfs(to,v); //mn[x] = min(mn[x],mn[to]); } //mn[x] = cnt; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { std::vector<int> labels(n,0); //for(int i = 0; i < n; i ++ ) labels[i] = i; for(int i = 0; i < u.size(); i++){ int x = u[i]; int y = v[i]; gr[x].pb(y); gr[y].pb(x); } if(k == 1000) cnt = 0; dfs(0,labels); for(int i = 0; i < n; i++) gr[i].clear(), fix[i] = 0; return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s > t || t > c.back()) return c[0]; for(int i = 1; i < c.size(); i++){ if(c[i] > t) return c[i-1]; } return c.back(); }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:35:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for(int i = 0; i < u.size(); i++){
      |                 ~~^~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:51:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |     for(int i = 1; i < c.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...