Submission #432978

#TimeUsernameProblemLanguageResultExecution timeMemory
432978MOUF_MAHMALATStations (IOI20_stations)C++14
0 / 100
3032 ms2097156 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; typedef int ll; ll in[1009],out[1009],ti; vector<vector<ll> >v; void dfs(ll d,ll p) { in[d]=ti; for(auto z:v[d]) if(z!=p) { ti++; dfs(z,d); } out[d]=ti; } vector<int> label(int n, int k, vector<int> U, vector<int> V) { v.resize(n); vector<ll>ans(n); for(ll i=0; i<U.size(); i++) { v[U[i]].push_back(V[i]); v[V[i]].push_back(U[i]); } dfs(0,0); for(ll i=0; i<n; i++) ans[i]=in[i]+(out[i]<<10); return ans; } int find_next_station(int s, int t, vector<int> c) { ll x=s&(1<<10-1),y=s>>10; ll xx=t&(1<<10-1),yy=t>>10; for(auto z:c) { ll o=z&(1<<10-1),oo=z>>10; if(x<=xx&&y>=yy&&o<=xx&&oo>=yy) return z; if((y<xx||x>yy)&&o<=x&&oo>=y) return z; if(xx<=x&&yy>=y&&o<=x&&oo>=y) return z; } }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:22:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(ll i=0; i<U.size(); i++)
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:35:18: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   35 |     ll x=s&(1<<10-1),y=s>>10;
      |                ~~^~
stations.cpp:36:19: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   36 |     ll xx=t&(1<<10-1),yy=t>>10;
      |                 ~~^~
stations.cpp:39:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   39 |         ll o=z&(1<<10-1),oo=z>>10;
      |                    ~~^~
stations.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^
#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...