Submission #869677

#TimeUsernameProblemLanguageResultExecution timeMemory
869677andrewpStations (IOI20_stations)C++14
0 / 100
1 ms600 KiB
//Dedicated to my love,ivaziva #include<bits/stdc++.h> #include "stations.h" using namespace std; #define ll long long #define pb push_back const int maxn=1050; const int mod=998244353; vector<int> es[maxn]; //ivice int tin[maxn],tout[maxn]; int vu=0,vi=0;//vreme ulaza, vreme izlaza void dfs(int u,int par){ tin[u]=vu++; for(auto e:es[u]){ if(e!=par){ dfs(e,u); } } tout[u]=vi++; } vector<int> label(int n,int k,vector<int> u,vector<int> v){ vector<int> kodiraj(n+1,0); for(int i=0;i<v.size();i++) u[i]++,v[i]++;//indeksiram od 1 for(int i=0;i<v.size();i++){ es[u[i]].pb(v[i]); es[v[i]].pb(u[i]); } vu=0,vi=0; dfs(1,-1); for(int i=1;i<=n;i++){ kodiraj[i]=tin[i]*10000+tout[i];//tout[i]<=2k } return kodiraj; } int find_next_station(int s,int e,vector<int> c){ if(e/10000<s/10000||e%10000>s%10000){ for(auto p:c){ if(p/10000<=s/10000) return p; } } for(auto p:c){ int x=p/10000,y=p%10000; if(x>s/10000&&x<=e/10000&&y>=e%10000) return p; } } // void sol(){ // } // int main(){ // int T=1; // // scanf("%d",&T); // while(T--){ // sol(); // } // return 0; // }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0;i<v.size();i++) u[i]++,v[i]++;//indeksiram od 1
      |                 ~^~~~~~~~~
stations.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
#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...