Submission #954953

#TimeUsernameProblemLanguageResultExecution timeMemory
954953irmuunStations (IOI20_stations)C++17
5 / 100
588 ms1020 KiB
#include<bits/stdc++.h> #include "stations.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() vector<int>label(int n,int k,vector<int>u,vector<int>v){ vector<int>l(n); vector<int>adj[n]; for(int i=0;i<n-1;i++){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } int mx=0; for(int i=0;i<n;i++){ mx=max(mx,(int)adj[i].size()); } if(mx<=2){ vector<int>ord; function <void(int,int)> dfs=[&](int x,int p){ ord.pb(x); for(auto y:adj[x]){ if(y!=p){ dfs(y,x); } } }; for(int i=0;i<n;i++){ if(adj[i].size()==1){ dfs(i,-1); break; } } for(int i=0;i<n;i++){ l[ord[i]]=i; } return l; } iota(all(l),1000); return l; } int find_next_station(int s,int t,vector<int>c){ if(s>=1000){ if(t<s) return c[0]; for(int i=1;i<c.size();i++){ int p=c[i]-1000,T=t-1000; while(T>p){ T=(T-1)/2; } if(T==p){ return c[i]; } } return c[0]; } else{ if(s>t) return c[0]; return c.back(); } }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:52:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         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...