Submission #616586

#TimeUsernameProblemLanguageResultExecution timeMemory
616586John3_141592Stations (IOI20_stations)C++14
0 / 100
4 ms324 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector <int> grafo[1003]; int arr[1003],C; bool vis[1003]; void dfs(int node){ vis[node]=true,arr[node]=0; for(auto i:grafo[node]) if(!vis[i]) dfs(i),arr[node]|=arr[i]; arr[node]|=(1<<C),C++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(int i=0;i<n;i++) grafo[i].clear(); for(int i=0;i<n-1;i++) grafo[u[i]].push_back(v[i]),grafo[v[i]].push_back(u[i]); C=0,dfs(0); vector <int> vec; for(int i=0;i<n;i++) vec.push_back(arr[i]); return vec; } int find_next_station(int s, int t, std::vector<int> c) { if(c.size()==1) return c[0]; for(auto i:c) if(i&t==t) return i; return c.back(); }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:27:25: warning: self-comparison always evaluates to true [-Wtautological-compare]
   27 |     for(auto i:c) if(i&t==t) return i;
      |                        ~^~~
stations.cpp:27:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   27 |     for(auto i:c) if(i&t==t) return 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...