思路:考试的时候我非常地**,写了圆并,然后还TM写了半平面交和三角剖分,虽然只有30分。。但是看在我写了500行的份上还是挂着吧。。

  1. #include<cstdio>
  2. #include<cmath>
  3. #include<cstring>
  4. #include<iostream>
  5. #include<algorithm>
  6. const double Pi=acos(-);
  7. const double eps=1e-;
  8. int n,m,cnt,tot,num;
  9. bool pd[],check;
  10. int read(){
  11. int t=,f=;char ch=getchar();
  12. while (ch<''||ch>'') {if (ch=='-') f=-;ch=getchar();}
  13. while (''<=ch&&ch<='') {t=t*+ch-'';ch=getchar();}
  14. return t*f;
  15. }
  16. struct node{
  17. double l,r;
  18. }L[];
  19. struct Point{
  20. double x,y;
  21. Point(){}
  22. Point(double x0,double y0):x(x0),y(y0){}
  23. }p[],c[],d[];
  24. struct Line{
  25. Point s,e;
  26. double slop;
  27. Line(){}
  28. Line(Point s0,Point e0):s(s0),e(e0){}
  29. }l[],q[];
  30. struct Circle{
  31. Point p;
  32. double r;
  33. Circle(){}
  34. Circle(double x0,double y0,double r0):p(Point(x0,y0)),r(r0){}
  35. }a[];
  36. bool cmp2(node a,node b){
  37. if (fabs(a.l-b.l)<eps) return a.r<b.r;
  38. else return (a.l<b.l);
  39. }
  40. int sgn(double x){if (x>eps) return ;if (x<-eps) return -;return ;}
  41. double operator *(Point p1,Point p2){return p1.x*p2.y-p1.y*p2.x;}
  42. double operator /(Point p1,Point p2){return p1.x*p2.x+p1.y*p2.y;}
  43. Point operator -(Point p1,Point p2){return Point(p1.x-p2.x,p1.y-p2.y);}
  44. Point operator +(Point p1,Point p2){return Point(p1.x+p2.x,p1.y+p2.y);}
  45. Point operator *(Point p1,double x){return Point(p1.x*x,p1.y*x);}
  46. Point operator /(Point p1,double x){return Point(p1.x/x,p1.y/x);}
  47. double sqr(double x){return x*x;}
  48. double llen(Point p1){return sqrt(sqr(p1.x)+sqr(p1.y)); }
  49. double dis(Point p1,Point p2){return llen(p1-p2);}
  50. double dis(Point p1){return llen(p1);}
  51. Point evector(Point p1){double t=llen(p1);if (t<eps) return Point(,);else return p1/t;}
  52. bool cmp3(Line p1,Line p2){
  53. if (p1.slop!=p2.slop) return p1.slop<p2.slop;
  54. else return (p1.e-p1.s)*(p2.e-p1.s)>;
  55. }
  56. bool cmp(Point p1,Point p2){
  57. double t=(p1-p[])*(p2-p[]);
  58. if (fabs(t)<eps) return dis(p[],p1)<dis(p[],p2);
  59. return t>;
  60. }
  61. bool conclude(Circle p1,Circle p2){
  62. double Len=dis(p1.p,p2.p);
  63. if (fabs(p1.r-p2.r)>=Len) return ;
  64. return ;
  65. }
  66. bool intersect(Circle p1,Circle p2){
  67. double Len=dis(p1.p,p2.p);
  68. if (fabs(p1.r-p2.r)<=Len&&Len<=p1.r+p2.r) return ;
  69. return ;
  70. }
  71. double dist_line(Line p){
  72. double A,B,C,dist;
  73. A=p.s.y-p.e.y;
  74. B=p.s.x-p.e.x;
  75. C=p.s.x*p.e.y-p.s.y*p.e.x;
  76. dist=fabs(C)/sqrt(sqr(A)+sqr(B));
  77. return dist;
  78. }
  79. double dist_line(Point p1,Line p){
  80. p.s.x-=p1.x;
  81. p.e.x-=p1.x;
  82. p.s.y-=p1.y;
  83. p.e.y-=p1.y;
  84. return dist_line(p);
  85. }
  86. double get_cos(double a,double b,double c){
  87. return (b*b+c*c-a*a)/(*b*c);
  88. }
  89. double get_angle(Point p1,Point p2){
  90. if (!sgn(dis(p1))||!sgn(dis(p2))) return 0.0;
  91. double A,B,C;
  92. A=dis(p1);
  93. B=dis(p2);
  94. C=dis(p1,p2);
  95. if (C<=eps) return 0.0;
  96. return fabs(acos(get_cos(C,A,B)));
  97. }
  98. Point get_point(Point p){
  99. double T=sqr(p.x)+sqr(p.y);
  100. return Point(sgn(p.x)*sqrt(sqr(p.x)/T),sgn(p.y)*sqrt(sqr(p.y)/T));
  101. }
  102. bool bigconclude(Circle p1,Circle p2,Point p){
  103. Point e1=p2.p-p1.p;
  104. Point e2=p-p1.p;
  105. if (sgn(e1/e2)<) return ;
  106. else return ;
  107. }
  108. double S(Point p1,Point p2,Point p3){
  109. return fabs((p2-p1)*(p3-p1))/;
  110. }
  111. double work(Point p1,Point p2,double R){
  112. Point O=Point(,);
  113. double f=sgn(p1*p2),res=;
  114. if (!sgn(f)||!sgn(dis(p1))||!sgn(dis(p2))) return 0.0;
  115. double l=dist_line(Line(p1,p2));
  116. double a=dis(p1);
  117. double b=dis(p2);
  118. double c=dis(p1,p2);
  119. if (a<=R&&b<=R){
  120. return fabs(p1*p2)/2.0*f;
  121. }
  122. if (a>=R&&b>=R&&l>=R){
  123. double ang=get_angle(p1,p2);
  124. return fabs((ang/(2.0))*(R*R))*f;
  125. }
  126. if (a>=R&&b>=R&&l<=R&&(get_cos(a,b,c)<=||get_cos(b,a,c)<=)){
  127. double ang=get_angle(p1,p2);
  128. return fabs((ang/(2.0))*(R*R))*f;
  129. }
  130. if (a>=R&&b>=R&&l<=R&&(get_cos(a,b,c)>&&get_cos(b,a,c)>)){
  131. double dist=dist_line(Line(p1,p2));
  132. double len=sqrt(sqr(R)-sqr(dist))*2.0;
  133. double ang1=get_angle(p1,p2);
  134. double cos2=get_cos(len,R,R);
  135. res+=fabs(len*dist/2.0);
  136. double ang2=ang1-acos(cos2);
  137. res+=fabs((ang2/())*(R*R));
  138. return res*f;
  139. }
  140. if ((a>=R&&b<R)||(a<R&&b>=R)){
  141. if (b>a) std::swap(a,b),std::swap(p1,p2);
  142. double T=sqr(p1.x-p2.x)+sqr(p1.y-p2.y);
  143. Point u=Point(sgn(p1.x-p2.x)*sqrt(sqr(p1.x-p2.x)/T),sgn(p1.y-p2.y)*sqrt(sqr(p1.y-p2.y)/T));
  144. double dist=dist_line(Line(p1,p2));
  145. double len=sqrt(R*R-dist*dist);
  146. double len2=sqrt(sqr(dis(p2))-sqr(dist));
  147. if (fabs(dis(p2+u*len2)-dist)<=eps) len+=len2;
  148. else len-=len2;
  149. Point p=p2+u*len;
  150. res+=S(O,p2,p);
  151. double ang=get_angle(p1,p);
  152. res+=fabs((ang/2.0)*R*R);
  153. return res*f;
  154. }
  155. return ;
  156. }
  157. Point inter(Line p1,Line p2){
  158. double t1=(p2.e-p1.s)*(p1.e-p1.s);
  159. double t2=(p1.e-p1.s)*(p2.s-p1.s);
  160. if (fabs(t1+t2)<eps) check=;
  161. double k=t1/(t1+t2);
  162. Point p;
  163. p.x=p2.e.x+(p2.s.x-p2.e.x)*k;
  164. p.y=p2.e.y+(p2.s.y-p2.e.y)*k;
  165. return p;
  166. }
  167. bool jud(Line p1,Line p2,Line p3){
  168. Point p=inter(p1,p2);
  169. return (p3.e-p3.s)*(p-p3.s)<;
  170. }
  171. double inter(Circle P){
  172. double res=;p[n+]=p[];
  173. for (int i=;i<=n+;i++)
  174. c[i].x=p[i].x-P.p.x,c[i].y=p[i].y-P.p.y;
  175. for (int i=;i<=n;i++)
  176. res+=work(c[i],c[i+],P.r);
  177. return res;
  178. }
  179. void hpi(){
  180. int L=,R=;tot=;
  181. for (int i=;i<=cnt;i++){
  182. if (l[i].slop!=l[i-].slop) tot++;
  183. l[tot]=l[i];
  184. }
  185. q[++R]=l[];q[++R]=l[];
  186. int all=tot;
  187. for (int i=;i<=all;i++){
  188. while (L<R&&jud(q[R],q[R-],l[i])) R--;
  189. while (L<R&&jud(q[L],q[L+],l[i])) L++;
  190. q[++R]=l[i];
  191. }
  192. while (L<R&&jud(q[R],q[R-],q[L])) R--;
  193. while (L<R&&jud(q[L],q[L+],q[R])) L++;
  194. tot=;
  195. for (int i=L;i<R;i++)
  196. d[++tot]=inter(q[i],q[i+]);
  197. }
  198. bool judge(Point p1,Point p2){
  199. return (fabs(p1.x-p2.x)<eps&&fabs(p1.y-p2.y)<eps);
  200. }
  201. double gworking1(Point c1,Point c2,Point p1,Point p2){
  202. double rev=sgn(c1*c2);
  203. if (fabs(rev)<eps) return ;
  204. num=;
  205. Point O=Point(,);
  206. if ((c1*c2)<) std::swap(c1,c2);
  207. l[++num].s=O,l[num].e=c1;if (judge(l[num].s,l[num].e)) num--;
  208. l[++num].s=c1,l[num].e=c2;if (judge(l[num].s,l[num].e)) num--;
  209. l[++num].s=c2,l[num].e=O;if (judge(l[num].s,l[num].e)) num--;
  210. if ((p1*p2)<) std::swap(p1,p2);
  211. l[++num].s=O,l[num].e=p1;if (judge(l[num].s,l[num].e)) num--;
  212. l[++num].s=p1,l[num].e=p2;if (judge(l[num].s,l[num].e)) num--;
  213. l[++num].s=p2,l[num].e=O;if (judge(l[num].s,l[num].e)) num--;
  214. for (int i=;i<=num;i++)
  215. l[i].slop=atan2(l[i].e.y-l[i].s.y,l[i].e.x-l[i].s.x);
  216. std::sort(l+,l++num,cmp3);
  217. check=;
  218. hpi();
  219. if (check) return ;
  220. d[tot+]=d[];
  221. double res=;
  222. for (int i=;i<=tot;i++)
  223. res+=(d[i]*d[i+])/2.0;
  224. return fabs(res)*rev;
  225. }
  226. double Gworking1(double a1,double a2,Circle w){
  227. double r=w.r;
  228. Point p1=Point(r*cos(a1),r*sin(a1));
  229. Point p2=Point(r*cos(a2),r*sin(a2));
  230. p[n+]=p[];
  231. for (int i=;i<=n+;i++)
  232. c[i]=Point(p[i].x-w.p.x,p[i].y-w.p.y);
  233. double res=;
  234. for (int i=;i<=n;i++)
  235. res+=gworking1(c[i],c[i+],p1,p2);
  236. return res;
  237. }
  238. Point inter(Circle p,Line l,Point p1){
  239. double Dist=dist_line(l);
  240. double dis1=llen(p1);
  241. double len=sqrt(sqr(dis1)-sqr(Dist));
  242. Point e=evector(l.e-l.s);
  243. Point sx=p1;
  244. double R=p.r;
  245. double len2=sqrt(sqr(R)-sqr(Dist));
  246. sx=sx-e*len;
  247. sx=sx+e*len2;
  248. return sx;
  249. }
  250. double gworking2(Point c1,Point c2,Point p1,Point p2,double R){
  251. double rev=sgn(c1*c2),res=;Point O=Point(,);
  252. if ((p1*p2)<) std::swap(p1,p2);
  253. if ((c1*c2)<) std::swap(c1,c2);
  254. if (fabs(rev)<eps) return ;
  255. if (!sgn(dis(p1))||!sgn(dis(p2))) return 0.0;
  256. double l=dist_line(Line(p1,p2));
  257. double a=dis(p1);
  258. double b=dis(p2);
  259. double c=dis(p1,p2);
  260. if (a<=R&&b<=R){
  261. res=fabs(p1*p2)/2.0;
  262. }
  263. else
  264. if (a>=R&&b>=R&&l>=R){
  265. double ang=get_angle(p1,p2);
  266. res=abs((ang/(2.0))*(R*R));
  267. }
  268. else
  269. if (a>=R&&b>=R&&l<=R&&(get_cos(a,b,c)<=||get_cos(b,a,c)<=)){
  270. double ang=get_angle(p1,p2);
  271. res=fabs((ang/(2.0))*(R*R));
  272. }
  273. else
  274. if (a>=R&&b>=R&&l<=R&&(get_cos(a,b,c)>&&get_cos(b,a,c)>)){
  275. double dist=dist_line(Line(p1,p2));
  276. double len=sqrt(sqr(R)-sqr(dist))*2.0;
  277. double ang1=get_angle(p1,p2);
  278. double cos2=get_cos(len,R,R);
  279. res+=fabs(len*dist/2.0);
  280. double ang2=ang1-acos(cos2);
  281. res+=fabs((ang2/())*(R*R));
  282. }
  283. else
  284. if ((a>=R&&b<R)||(a<R&&b>=R)){
  285. if (b>a) std::swap(a,b),std::swap(p1,p2);
  286. double T=sqr(p1.x-p2.x)+sqr(p1.y-p2.y);
  287. Point u=Point(sgn(p1.x-p2.x)*sqrt(sqr(p1.x-p2.x)/T),sgn(p1.y-p2.y)*sqrt(sqr(p1.y-p2.y)/T));
  288. double dist=dist_line(Line(p1,p2));
  289. double len=sqrt(R*R-dist*dist);
  290. double len2=sqrt(sqr(dis(p2))-sqr(dist));
  291. if (fabs(dis(p2+u*len2)-dist)<=eps) len+=len2;
  292. else len-=len2;
  293. Point p=p2+u*len;
  294. res+=S(O,p2,p);
  295. double ang=get_angle(p1,p);
  296. res+=fabs((ang/2.0)*R*R);
  297. }
  298. int in1=((sgn(c1*p1)*sgn(p1*c2))>=);
  299. int in2=((sgn(c1*p2)*sgn(p2*c2))>=);
  300. if (in1&&in2) return res*rev;
  301. if (!in1){
  302. if (dis(p1)<=R){
  303. Point sb=inter(Line(O,c1),Line(p1,p2));
  304. double Di=dis(sb);
  305. if (Di<=R) res-=S(O,sb,p1);
  306. else{
  307. Point sx=inter(Circle(,,R),Line(p1,p2),p1);
  308. double ang=get_angle(c1,sx);
  309. res-=fabs((ang/2.0)*R*R);
  310. res-=S(O,sx,p1);
  311. }
  312. }else{
  313. Point sb=inter(Line(O,c1),Line(p1,p2));
  314. double Di=dis(sb);
  315. if (Di>=R){
  316. double ang=get_angle(c1,p1);
  317. res-=fabs((ang/2.0)*R*R);
  318. }else{
  319. Point sx=inter(Circle(,,R),Line(p1,p2),p1);
  320. double ang2=get_angle(p1,sx);
  321. res-=fabs((ang2/2.0)*R*R);
  322. res-=S(sb,sx,O);
  323. }
  324. }
  325. }
  326. if (!in2){
  327. if (dis(p2)<=R){
  328. Point sb=inter(Line(O,c2),Line(p1,p2));
  329. double Di=dis(sb);
  330. if (Di<=R) res-=S(O,sb,p2);
  331. else{
  332. Point sx=inter(Circle(,,R),Line(p2,p1),p2);
  333. double ang=get_angle(c2,sx);
  334. res-=fabs((ang/2.0)*R*R);
  335. res-=S(O,sx,p2);
  336. }
  337. }else{
  338. Point sb=inter(Line(O,c2),Line(p1,p2));
  339. double Di=dis(sb);
  340. if (Di>=R){
  341. double ang=get_angle(c2,p2);
  342. res-=fabs((ang/2.0)*R*R);
  343. }else{
  344. Point sx=inter(Circle(,,R),Line(p2,p1),p2);
  345. double ang2=get_angle(p2,sx);
  346. res-=fabs((ang2/2.0)*R*R);
  347. res-=S(sb,sx,O);
  348. }
  349. }
  350. }
  351. return res*rev;
  352. }
  353. double Gworking2(double a1,double a2,Circle w){
  354. double res=,r=w.r;
  355. Point p1=Point(r*cos(a1),r*sin(a1));
  356. Point p2=Point(r*cos(a2),r*sin(a2));
  357. p[n+]=p[];
  358. for (int i=;i<=n+;i++)
  359. c[i]=Point(p[i].x-w.p.x,p[i].y-w.p.y);
  360. for (int i=;i<=n;i++)
  361. res+=gworking2(c[i],c[i+],p1,p2,r);
  362. return res;
  363. }
  364. void graham(){
  365. int k=;
  366. for (int i=;i<=n;i++)
  367. if (p[i].y<p[k].y||(p[i].x<p[k].x&&p[i].y==p[k].y)) k=i;
  368. std::sort(p+,p++n,cmp);
  369. int top=;c[top]=p[];
  370. for (int i=;i<=n;i++){
  371. while (top>&&(c[top]-c[top-])*(p[i]-c[top])<=) top--;
  372. c[++top]=p[i];
  373. }
  374. n=top;
  375. for (int i=;i<=top;i++)
  376. p[i]=c[i];
  377. }
  378. void Work(Circle p1,Point a1,Point a2){
  379. Point O=p1.p;double r=p1.r;
  380. a1.x-=O.x;a2.x-=O.x;
  381. a1.y-=O.y;a2.y-=O.y;
  382. double x1=atan2(a1.y,a1.x),x2=atan2(a2.y,a2.x);
  383. if (x1<) x1+=*Pi;
  384. if (x2<) x2+=*Pi;
  385. if (x1<=x2){
  386. cnt++;
  387. L[cnt].l=x1;
  388. L[cnt].r=x2;
  389. }else{
  390. cnt++;
  391. L[cnt].l=x1;
  392. L[cnt].r=*Pi;
  393. cnt++;
  394. L[cnt].l=0.0;
  395. L[cnt].r=x2;
  396. }
  397. }
  398. void add(Circle p1,Circle p2){
  399. double x1=p1.p.x,x2=p2.p.x,y1=p1.p.y,y2=p2.p.y,r1=p1.r,r2=p2.r;
  400. double A=-*(x1+x2),B=-*(y1+y2),C=sqr(x1)+sqr(x2)+sqr(y1)+sqr(y2)-sqr(r1)-sqr(r2);
  401. Point S,E;
  402. if (fabs(A)<eps){
  403. S=Point(,(C)/B);
  404. E=Point(,(C)/B);
  405. }else
  406. if (fabs(B)<eps){
  407. S=Point((C)/A,);
  408. E=Point((C)/A,);
  409. }else{
  410. S=Point(,(C-A)/B);
  411. E=Point(,(C-*A)/B);
  412. }
  413. Line l=Line(S,E);
  414. double Dist1=dist_line(p1.p,l);
  415. double Dist2=llen(p1.p-S);
  416. Point e=evector(E-S);
  417. double Dist3=sqrt(sqr(Dist2)-sqr(Dist1));
  418. e=e*Dist3;
  419. Point a1,a2;
  420. if (fabs(dis(S+e,p1.p)-Dist1)<eps){
  421. S=S+e;
  422. }
  423. else S=S-e;
  424. e=e/Dist3;
  425. double Dist4=sqrt(sqr(p1.r)-sqr(llen(S-p1.p)));
  426. e=e*Dist4;
  427. a1=S+e;
  428. a2=S-e;
  429. if ((a1-p1.p)*(a2-p1.p)<) std::swap(a1,a2);
  430. //a1放在a2的顺时针方向、
  431. if (bigconclude(p1,p2,a1)) std::swap(a1,a2);
  432. //a1到a2必须是逆时针。
  433. Work(p1,a1,a2);
  434. }
  435. int main(){
  436. freopen("aerolite.in","r",stdin);
  437. freopen("aerolite.out","w",stdout);
  438. scanf("%d",&m);
  439. for (int i=;i<=m;i++){
  440. scanf("%lf%lf%lf",&a[i].p.x,&a[i].p.y,&a[i].r);
  441. }
  442. scanf("%d",&n);
  443. for (int i=;i<=n;i++){
  444. scanf("%lf%lf",&p[i].x,&p[i].y);
  445. }
  446. graham();
  447. for (int i=;i<=m;i++) pd[i]=;
  448. for (int i=;i<=m;i++){
  449. for (int j=;j<=m;j++)
  450. if (i!=j){
  451. if (conclude(a[i],a[j])) {pd[i]=;break;}
  452. }
  453. }
  454. double ans=;
  455. for (int i=;i<=m;i++)
  456. if (pd[i]){
  457. bool mark=;
  458. for (int j=;j<=m;j++)
  459. if (i!=j&&pd[j]){
  460. if (intersect(a[i],a[j])) {mark=;break;}
  461. }
  462. if (!mark) ans+=inter(a[i]),pd[i]=;
  463. }
  464. int j=;
  465. for (int i=;i<=m;i++)
  466. if (pd[i]) a[++j]=a[i];
  467. for (int i=;i<=m;i++) pd[i]=;
  468. for (int i=;i<=m;i++){
  469. cnt=;
  470. for (int j=;j<=m;j++)
  471. if (i!=j){
  472. add(a[i],a[j]);
  473. }
  474. std::sort(L+,L++cnt,cmp2);
  475. L[].r=0.0;
  476. L[cnt+].l=*Pi;
  477. double Reach=0.0,Last=0.0;
  478. int ww=;
  479. for (int j=;j<=cnt;j++)
  480. if (L[j].l>Reach){
  481. if (j==) ww++;
  482. ans+=Gworking1(Last,Reach,a[i]);
  483. Last=L[j].l;
  484. ans+=Gworking2(Reach,L[j].l,a[i]);
  485. Reach=L[j].r;
  486. }else{
  487. Reach=L[j].r;
  488. }
  489. if (fabs(Reach-*Pi)<eps){
  490. ans+=Gworking1(Last,Reach,a[i]);
  491. }else
  492. if (fabs(Reach-*Pi)>=eps){
  493. ans+=Gworking1(Last,Reach,a[i]);
  494. ans+=Gworking2(Reach,*Pi,a[i]);
  495. }
  496. }
  497. printf("%.8lf\n",ans);
  498. return ;
  499. }

NOI十连测 第六测 T3的更多相关文章

  1. NOI十连测 第六测 T1

    思路: 用treap动态维护,记一个sum1,sum2,注意!,写treap如果有删除操作,千万不能把权值相同的分开来..,这在删除的时候会进入死循环,这是一个惨痛的教训... #include< ...

  2. <转>二十问全链路压测干货汇总(上)

    本文转载自:微信公众号-数列科技<二十问全链路压测干货汇总(上)> 最近几年全链路压测无疑成为了一个热门话题,在各个技术峰会上都可以看到它的身影. 一些大型的互联网公司,比如阿里巴巴.京东 ...

  3. 「NOI十联测」深邃

    「NOI十联测」深邃 要使得最大的连通块最小,显然先二分答案. 先固定1结点为根. 对于一个果实,显然是先处理子树中未分配的点,再向外延伸. 每个结点记录一个\(si[]\),表示子树中未分配的点数, ...

  4. 「NOI十联测」奥义商店

    「NOI十联测」奥义商店 若lzz想花费最少的钱,那么显然要选择数目较少的颜色. 先考虑暴力的写法. 每次向两边统计,每个物品要求被买的概率可以由上一个物品推出. now=1;//now 被买概率 M ...

  5. 「NOI十联测」黑暗

    「NOI十联测」黑暗 \(n\) 个点的无向图,每条边都可能存在,一个图的权值是连通块个数的 \(m\) 次方,求所有可能的图的权值和.(n≤30000,m≤15) 令\(ans[n][m]\)为n个 ...

  6. NOI十连测 第四测 T3

    思路: 算法一:可以n^2找出每个点的权值,然后n^2做完,预计得分10 算法二:随机找点然后每次找最高..貌似只有10分?然而考试的时候煞笔了,边界设成inf.. 算法三:随机找几个点,然后随机爬山 ...

  7. NOI十连测 第五测 T2

    思路:考虑建立可持久化线段树,第一层维护的是i这个位置的next位置,第二层,维护的是接下来走这个字符会到哪个节点. 感觉很巧妙啊,不愧是Claris #include<algorithm> ...

  8. NOI十连测 第五测 T1

    #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #inclu ...

  9. NOI十连测 第四测 T2

    思路:线段树套可持久化treap,可持久化treap我还是第一次听说.. 改题的时候没看数据范围..乱开数组T_T #include<algorithm> #include<cstd ...

随机推荐

  1. php跨服务器传递对象

    最近因为研究跨域名,跨服务器的问题,所以无聊,就想到了一个跨服务器传递对象的问题. 想要跨服务器传递数据,那么就要使用到get或者post提交. 我这里的方法有点复杂,但是因为平时工作时,有封装相应的 ...

  2. C51工具是怎么进行覆盖分析的

    C51工具针对8051微控制器的有限存储器资源进行了优化设计. 为了最有效地利用存储器,根据一个很容易解释的方法,自动变量和函数参数在存储器中均进行覆盖处理. 首先,连接器根据源程序生成调用树.例如: ...

  3. thinkjs与Fine Uploader的邂逅

        最近在做一个内部系统,需要一个无刷新的上传功能,找了许久,发现了一个好用的上传工具-Fine Uploader,网上也有不少关于它的介绍,对我有不少的启发,结合我的使用场景简单的介绍一下它与t ...

  4. SharePoint excel service web part 连接到 filter web part

    本文讲述SharePoint excel service web part 连接到 filter web part的一个简单应用场景. SharePoint excel service web par ...

  5. Linux usb子系统(三):通过usbfs操作设备的用户空间驱动

    内核中提供了USB设备文件系统(usbdevfs,Linux 2.6改为usbfs,即USB文件系统),它和/proc类似,都是动态产生的.通过在/etc/fstab文件中添加如下一行:none /p ...

  6. js实现a标签超链接提交form表单的方法

    <a class="regButton"    id="saveRegister" onclick="document.getElementBy ...

  7. ios 计算文字的尺寸

    /** * 计算文字尺寸 * @param text 需要计算尺寸的文字 * @param font 文字的字体 * @param maxSize 文字的最大尺寸 */ - (CGSize)sizeW ...

  8. 《Swift开发指南》国内第一本Swift图书上市了

    <Swift开发指南>国内第一本Swift图书上市了 既<courseId=799262">苹果Swift编程语言开发指南>视频教程地址:courseId=79 ...

  9. [重磅] 让HTML5达到原生的体验 系列之中的一个 避免切页白屏

    非常多人都想.甚至曾使用HTML5开发跨平台App.而且想达到原生App的体验. 最后的结果都是无奈的放弃.HTML5貌似美好,但坑太多.想做到原生App的体验差点儿不可为. 也曾有过著名的faceb ...

  10. 移动支付之智能IC卡与Android手机进行NFC通信

    本文来自http://blog.csdn.net/hellogv/ .引用必须注明出处.        眼下常见的智能IC卡执行着JavaCard虚拟机.智能IC卡上能够执行由精简后的Java语言编写 ...