Submission #1080166

#TimeUsernameProblemLanguageResultExecution timeMemory
1080166Sir_Ahmed_ImranStations (IOI20_stations)C++17
52.32 / 100
657 ms1272 KiB
///~~~LOTA~~~/// //#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 1000 int m; vector<int> l; vector<int> a[N]; void dfs(int v,int u){ int r=1e9; for(auto& i:a[v]){ if(i==u) continue; dfs(i,v); r=min(r,l[i]/1000); } l[v]=min(r,m)*1000+m; m++; } vector<int> label(int n,int k,vector<int> u,vector<int> v){ l.clear(); for(int i=0;i<n;i++){ a[i].clear(); l.append(0); } for(int i=m=0;i<n-1;i++){ a[u[i]].append(v[i]); a[v[i]].append(u[i]); } dfs(0,-1); return l; } int find_next_station(int s,int t,vector<int> c){ int l,r,p,q,x,y,z; l=s/1000;r=s%1000; p=t/1000;q=t%1000; for(auto& i:c){ x=i/1000; y=i%1000; if(x<=l && r<=y) z=i; if(l<=x && y<=r && x<=p && q<=y) return i; } return z; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:45:21: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |     int l,r,p,q,x,y,z;
      |                     ^
#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...