Submission #337315

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3373152020-12-19 16:53:32GiselusRailway (BOI17_railway)C++14
100 / 100
177 ms24556 KiB
#include<cstdio>
#include<algorithm>
#include<vector>
#define S 100007
using namespace std;
vector < vector < int > > L;
pair < int, int > E[S];
int num[S];
int R[S][20];
pair < int, int > t[S];
int dp[S];
bool ta[S];
int poz[S];
int pom = 0;
void DFS(int x, int p){
poz[x] = poz[p]+1;
pom++;
num[x] = pom;
for(int i = 1; i <= 19; i++){
R[x][i] = R[R[x][i-1]][i-1];
}
for(int i = 0; i < L[x].size(); i++){
if(L[x][i] != p){
R[L[x][i]][0] = x;
DFS(L[x][i],x);
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

railway.cpp: In function 'void DFS(int, int)':
railway.cpp:24:22: 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 < L[x].size(); i++){
      |                    ~~^~~~~~~~~~~~~
railway.cpp: In function 'void DFS2(int, int)':
railway.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i = 0 ; i < L[x].size();i++){
      |                     ~~^~~~~~~~~~~~~
railway.cpp: In function 'int main()':
railway.cpp:61:17: warning: unused variable 'c' [-Wunused-variable]
   61 |     int n,m,a,b,c,d,x,k,q;
      |                 ^
railway.cpp:61:19: warning: unused variable 'd' [-Wunused-variable]
   61 |     int n,m,a,b,c,d,x,k,q;
      |                   ^
railway.cpp:62:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   62 |     scanf("%d %d %d",&n,&m,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
railway.cpp:65:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   65 |         scanf("%d %d",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~
railway.cpp:73:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   73 |         scanf("%d",&q);
      |         ~~~~~^~~~~~~~~
railway.cpp:75:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   75 |             scanf("%d",&x);
      |             ~~~~~^~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...