제출 #869693

#제출 시각아이디문제언어결과실행 시간메모리
869693andrewp기지국 (IOI20_stations)C++14
10 / 100
547 ms1056 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 mx=1000; const int mod=998244353; vector<int> es[maxn]; //ivice int tin[maxn],tout[maxn]; int vr=0; void dfs(int u,int par){ tin[u]=vr;vr++; for(auto e:es[u]){ if(e!=par){ dfs(e,u); } } tout[u]=vr-1; } vector<int> label(int n,int k,vector<int> u,vector<int> v){ vector<int> kodiraj(n,0); for(int i=0;i<n;i++) es[i].clear(); for(int i=0;i<v.size();i++){ es[u[i]].pb(v[i]); es[v[i]].pb(u[i]); } dfs(0,-1); for(int i=0;i<n;i++){ kodiraj[i]=tin[i]*mx+tout[i];//tout[i]<=1k } return kodiraj; } int find_next_station(int s,int e,vector<int> c){ int ine=e/mx,oute=e%mx; int ins=s/mx,outs=s%mx; if(ine>=ins&&outs>=oute){ bool root=ins==0; for(int i=(root?0:1);i<c.size();i++){ int ini=c[i]/1000,outi=c[i]%1000; if(ine>=ini&&outi>=oute) return c[i]; } } return c[0]; } // void sol(){ // } // int main(){ // int T=1; // // scanf("%d",&T); // while(T--){ // sol(); // } // return 0; // }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:40:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i=(root?0: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...