noip2016 (difficult as HLJOI2016???)

D1:

T2:

Feeling quite hard but some points quite enough tips

 1 #include<cstdio>
 2 #include<algorithm>
 3 #include<iostream>
 4 #include<cstring>
 5 #include<cstdlib>
 6 #include<cmath>
 7 using namespace std;
 8 template<typename T>
 9 inline void read(T &a){
10     a=0;T b=1;char x=getchar();
11     while(x<'0'||'9'<x){
12         if(x=='-')b=-1;
13         x=getchar();
14     }
15     while('0'<=x&&x<='9'){
16         a=(a<<1)+(a<<3)+x-'0';
17         x=getchar();
18     }
19     a*=b;
20 }
21 char C_[50];
22 int TEMP;
23 template<typename T>
24 inline void write(T a){
25     if(a<0){
26          putchar('-');
27          a=-a;
28     }
29     do{
30          C_[++TEMP]=a%10+'0';
31          a/=10;
32     }while(a);
33     while(TEMP)putchar(C_[TEMP--]);
34 }
35 /*
36  contributes to the arithmetic monotonous path from u to v,
 37  if and only if the path and the path through the point i and the distance from the starting point i is equal to Wi
 38 is  
39  then the differential
 40  put u-> v <=> u-> lca lca- > <=> V 
 41 is  U-> the root (contribution +1) 
 42 is  LCA-> the root (contribution -1) 
 43 is  
44 is  directory root-> FA [LCA] (contribution -1) 
 45  the root -> (contribution +1) 
 46  * / 
47  int main ()
 48  {
 49       return  0 ;
 50 }
running

 

Guess you like

Origin www.cnblogs.com/a-blog-of-taojiayi-2003/p/11440956.html