0000: 23 69 6e 63 6c 75 64 65 20 3c 69 6f 73 74 72 65 #include <iostre
0010: 61 6d 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 73 am>..#include <s
0020: 73 74 72 65 61 6d 3e 0d 0a 23 69 6e 63 6c 75 64 stream>..#includ
0030: 65 20 3c 69 6f 6d 61 6e 69 70 3e 0d 0a 23 69 6e e <iomanip>..#in
0040: 63 6c 75 64 65 20 3c 76 65 63 74 6f 72 3e 0d 0a clude <vector>..
0050: 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 #include <string
0060: 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 6d 61 70 >..#include <map
0070: 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 73 65 74 >..#include <set
0080: 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 61 6c 67 >..#include <alg
0090: 6f 72 69 74 68 6d 3e 0d 0a 23 69 6e 63 6c 75 64 orithm>..#includ
00a0: 65 20 3c 6e 75 6d 65 72 69 63 3e 0d 0a 23 69 6e e <numeric>..#in
00b0: 63 6c 75 64 65 20 3c 69 74 65 72 61 74 6f 72 3e clude <iterator>
00c0: 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 66 75 6e 63 ..#include <func
00d0: 74 69 6f 6e 61 6c 3e 0d 0a 23 69 6e 63 6c 75 64 tional>..#includ
00e0: 65 20 3c 63 6f 6d 70 6c 65 78 3e 0d 0a 23 69 6e e <complex>..#in
00f0: 63 6c 75 64 65 20 3c 71 75 65 75 65 3e 0d 0a 23 clude <queue>..#
0100: 69 6e 63 6c 75 64 65 20 3c 73 74 61 63 6b 3e 0d include <stack>.
0110: 0a 23 69 6e 63 6c 75 64 65 20 3c 63 6d 61 74 68 .#include <cmath
0120: 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 3c 63 61 73 >..#include <cas
0130: 73 65 72 74 3e 0d 0a 23 69 6e 63 6c 75 64 65 20 sert>..#include
0140: 3c 74 75 70 6c 65 3e 0d 0a 75 73 69 6e 67 20 6e <tuple>..using n
0150: 61 6d 65 73 70 61 63 65 20 73 74 64 3b 0d 0a 74 amespace std;..t
0160: 79 70 65 64 65 66 20 6c 6f 6e 67 20 6c 6f 6e 67 ypedef long long
0170: 20 4c 4c 3b 0d 0a 0d 0a 74 65 6d 70 6c 61 74 65 LL;....template
0180: 3c 74 79 70 65 6e 61 6d 65 20 54 3e 0d 0a 63 6c <typename T>..cl
0190: 61 73 73 20 49 64 47 65 6e 0d 0a 7b 0d 0a 09 6d ass IdGen..{...m
01a0: 61 70 3c 54 2c 20 69 6e 74 3e 20 76 32 69 64 5f ap<T, int> v2id_
01b0: 3b 0d 0a 09 76 65 63 74 6f 72 3c 54 3e 20 20 20 ;...vector<T>
01c0: 69 64 32 76 5f 3b 0d 0a 70 75 62 6c 69 63 3a 0d id2v_;..public:.
01d0: 0a 09 69 6e 74 20 76 32 69 64 28 63 6f 6e 73 74 ..int v2id(const
01e0: 20 54 26 20 76 29 20 7b 0d 0a 09 09 69 66 28 20 T& v) {....if(
01f0: 21 76 32 69 64 5f 2e 63 6f 75 6e 74 28 76 29 20 !v2id_.count(v)
0200: 29 20 7b 20 76 32 69 64 5f 5b 76 5d 20 3d 20 73 ) { v2id_[v] = s
0210: 69 7a 65 28 29 3b 20 69 64 32 76 5f 2e 70 75 73 ize(); id2v_.pus
0220: 68 5f 62 61 63 6b 28 76 29 3b 20 7d 0d 0a 09 09 h_back(v); }....
0230: 72 65 74 75 72 6e 20 76 32 69 64 5f 5b 76 5d 3b return v2id_[v];
0240: 0d 0a 09 7d 0d 0a 09 63 6f 6e 73 74 20 54 26 20 ...}...const T&
0250: 69 64 32 76 28 69 6e 74 20 69 29 20 63 6f 6e 73 id2v(int i) cons
0260: 74 20 7b 20 72 65 74 75 72 6e 20 69 64 32 76 5f t { return id2v_
0270: 5b 69 5d 3b 20 7d 0d 0a 09 69 6e 74 20 73 69 7a [i]; }...int siz
0280: 65 28 29 20 63 6f 6e 73 74 20 7b 20 72 65 74 75 e() const { retu
0290: 72 6e 20 69 64 32 76 5f 2e 73 69 7a 65 28 29 3b rn id2v_.size();
02a0: 20 7d 0d 0a 7d 3b 0d 0a 0d 0a 74 65 6d 70 6c 61 }..};....templa
02b0: 74 65 3c 74 79 70 65 6e 61 6d 65 20 56 65 72 74 te<typename Vert
02c0: 2c 20 74 79 70 65 6e 61 6d 65 20 46 6c 6f 77 2c , typename Flow,
02d0: 20 69 6e 74 20 4e 56 3d 32 30 34 38 3e 0d 0a 63 int NV=2048>..c
02e0: 6c 61 73 73 20 4d 61 78 46 6c 6f 77 0d 0a 7b 0d lass MaxFlow..{.
02f0: 0a 09 49 64 47 65 6e 3c 56 65 72 74 3e 20 69 64 ..IdGen<Vert> id
0300: 67 65 6e 3b 0d 0a 09 76 65 63 74 6f 72 3c 69 6e gen;...vector<in
0310: 74 3e 20 47 5b 4e 56 5d 3b 0d 0a 09 46 6c 6f 77 t> G[NV];...Flow
0320: 20 46 5b 4e 56 5d 5b 4e 56 5d 3b 0d 0a 0d 0a 70 F[NV][NV];....p
0330: 75 62 6c 69 63 3a 0d 0a 09 76 6f 69 64 20 61 64 ublic:...void ad
0340: 64 45 64 67 65 28 20 56 65 72 74 20 73 5f 2c 20 dEdge( Vert s_,
0350: 56 65 72 74 20 74 5f 2c 20 46 6c 6f 77 20 66 20 Vert t_, Flow f
0360: 29 0d 0a 09 7b 0d 0a 09 09 63 6f 6e 73 74 20 69 )...{....const i
0370: 6e 74 20 73 20 3d 20 69 64 67 65 6e 2e 76 32 69 nt s = idgen.v2i
0380: 64 28 73 5f 29 2c 20 74 20 3d 20 69 64 67 65 6e d(s_), t = idgen
0390: 2e 76 32 69 64 28 74 5f 29 3b 0d 0a 09 09 47 5b .v2id(t_);....G[
03a0: 73 5d 2e 70 75 73 68 5f 62 61 63 6b 28 74 29 3b s].push_back(t);
03b0: 0d 0a 09 09 47 5b 74 5d 2e 70 75 73 68 5f 62 61 ....G[t].push_ba
03c0: 63 6b 28 73 29 3b 0d 0a 09 09 46 5b 73 5d 5b 74 ck(s);....F[s][t
03d0: 5d 20 3d 20 66 3b 0d 0a 09 09 46 5b 74 5d 5b 73 ] = f;....F[t][s
03e0: 5d 20 3d 20 30 3b 0d 0a 09 7d 0d 0a 0d 0a 09 46 ] = 0;...}.....F
03f0: 6c 6f 77 20 63 61 6c 63 28 20 56 65 72 74 20 73 low calc( Vert s
0400: 5f 2c 20 56 65 72 74 20 74 5f 20 29 0d 0a 09 7b _, Vert t_ )...{
0410: 0d 0a 09 09 63 6f 6e 73 74 20 69 6e 74 20 53 20 ....const int S
0420: 3d 20 69 64 67 65 6e 2e 76 32 69 64 28 73 5f 29 = idgen.v2id(s_)
0430: 2c 20 44 20 3d 20 69 64 67 65 6e 2e 76 32 69 64 , D = idgen.v2id
0440: 28 74 5f 29 3b 0d 0a 09 09 66 6f 72 28 20 46 6c (t_);....for( Fl
0450: 6f 77 20 74 6f 74 61 6c 3d 30 20 3b 3b 20 29 20 ow total=0 ;; )
0460: 7b 0d 0a 09 09 09 2f 2f 20 44 6f 20 42 46 53 20 {.....// Do BFS
0470: 61 6e 64 20 63 6f 6d 70 75 74 65 20 74 68 65 20 and compute the
0480: 6c 65 76 65 6c 20 66 6f 72 20 65 61 63 68 20 6e level for each n
0490: 6f 64 65 2e 0d 0a 09 09 09 69 6e 74 20 4c 56 5b ode......int LV[
04a0: 4e 56 5d 20 3d 20 7b 30 7d 3b 0d 0a 09 09 09 76 NV] = {0};.....v
04b0: 65 63 74 6f 72 3c 69 6e 74 3e 20 51 28 31 2c 20 ector<int> Q(1,
04c0: 53 29 3b 0d 0a 09 09 09 66 6f 72 28 69 6e 74 20 S);.....for(int
04d0: 6c 76 3d 31 3b 20 21 51 2e 65 6d 70 74 79 28 29 lv=1; !Q.empty()
04e0: 3b 20 2b 2b 6c 76 29 20 7b 0d 0a 09 09 09 09 76 ; ++lv) {......v
04f0: 65 63 74 6f 72 3c 69 6e 74 3e 20 51 32 3b 0d 0a ector<int> Q2;..
0500: 09 09 09 09 66 6f 72 28 73 69 7a 65 5f 74 20 69 ....for(size_t i
0510: 3d 30 3b 20 69 21 3d 51 2e 73 69 7a 65 28 29 3b =0; i!=Q.size();
0520: 20 2b 2b 69 29 20 7b 0d 0a 09 09 09 09 09 63 6f ++i) {.......co
0530: 6e 73 74 20 76 65 63 74 6f 72 3c 69 6e 74 3e 26 nst vector<int>&
0540: 20 6e 65 20 3d 20 47 5b 51 5b 69 5d 5d 3b 0d 0a ne = G[Q[i]];..
0550: 09 09 09 09 09 66 6f 72 28 73 69 7a 65 5f 74 20 .....for(size_t
0560: 6a 3d 30 3b 20 6a 21 3d 6e 65 2e 73 69 7a 65 28 j=0; j!=ne.size(
0570: 29 3b 20 2b 2b 6a 29 0d 0a 09 09 09 09 09 09 69 ); ++j)........i
0580: 66 28 20 46 5b 51 5b 69 5d 5d 5b 6e 65 5b 6a 5d f( F[Q[i]][ne[j]
0590: 5d 20 26 26 20 21 4c 56 5b 6e 65 5b 6a 5d 5d 20 ] && !LV[ne[j]]
05a0: 26 26 20 6e 65 5b 6a 5d 21 3d 53 20 29 0d 0a 09 && ne[j]!=S )...
05b0: 09 09 09 09 09 09 4c 56 5b 6e 65 5b 6a 5d 5d 3d ......LV[ne[j]]=
05c0: 6c 76 2c 20 51 32 2e 70 75 73 68 5f 62 61 63 6b lv, Q2.push_back
05d0: 28 6e 65 5b 6a 5d 29 3b 0d 0a 09 09 09 09 7d 0d (ne[j]);......}.
05e0: 0a 09 09 09 09 51 2e 73 77 61 70 28 51 32 29 3b .....Q.swap(Q2);
05f0: 0d 0a 09 09 09 7d 0d 0a 0d 0a 09 09 09 2f 2f 20 .....}.......//
0600: 44 65 73 74 69 6e 61 74 69 6f 6e 20 69 73 20 6e Destination is n
0610: 6f 77 20 75 6e 72 65 61 63 68 61 62 6c 65 2e 20 ow unreachable.
0620: 44 6f 6e 65 2e 0d 0a 09 09 09 69 66 28 20 21 4c Done......if( !L
0630: 56 5b 44 5d 20 29 0d 0a 09 09 09 09 72 65 74 75 V[D] )......retu
0640: 72 6e 20 74 6f 74 61 6c 3b 0d 0a 0d 0a 09 09 09 rn total;.......
0650: 2f 2f 20 49 74 65 72 61 74 69 6e 67 20 44 46 53 // Iterating DFS
0660: 2e 0d 0a 09 09 09 62 6f 6f 6c 20 62 6c 6f 63 6b ......bool block
0670: 65 64 5b 4e 56 5d 20 3d 20 7b 7d 3b 0d 0a 09 09 ed[NV] = {};....
0680: 09 74 6f 74 61 6c 20 2b 3d 20 64 69 6e 69 63 5f .total += dinic_
0690: 64 66 73 28 20 53 2c 20 44 2c 20 4c 56 2c 20 30 dfs( S, D, LV, 0
06a0: 78 37 66 66 66 66 66 66 66 2c 20 62 6c 6f 63 6b x7fffffff, block
06b0: 65 64 20 29 3b 0d 0a 09 09 7d 0d 0a 09 7d 0d 0a ed );....}...}..
06c0: 0d 0a 70 72 69 76 61 74 65 3a 0d 0a 09 46 6c 6f ..private:...Flo
06d0: 77 20 64 69 6e 69 63 5f 64 66 73 28 20 69 6e 74 w dinic_dfs( int
06e0: 20 76 2c 20 69 6e 74 20 44 2c 20 69 6e 74 20 4c v, int D, int L
06f0: 56 5b 5d 2c 20 46 6c 6f 77 20 66 6c 6f 77 5f 69 V[], Flow flow_i
0700: 6e 2c 20 62 6f 6f 6c 20 62 6c 6f 63 6b 65 64 5b n, bool blocked[
0710: 5d 20 29 0d 0a 09 7b 0d 0a 09 09 46 6c 6f 77 20 ] )...{....Flow
0720: 66 6c 6f 77 5f 6f 75 74 20 3d 20 30 3b 0d 0a 09 flow_out = 0;...
0730: 09 66 6f 72 28 73 69 7a 65 5f 74 20 69 3d 30 3b .for(size_t i=0;
0740: 20 69 21 3d 47 5b 76 5d 2e 73 69 7a 65 28 29 3b i!=G[v].size();
0750: 20 2b 2b 69 29 20 7b 0d 0a 09 09 09 69 6e 74 20 ++i) {.....int
0760: 75 20 3d 20 47 5b 76 5d 5b 69 5d 3b 0d 0a 09 09 u = G[v][i];....
0770: 09 69 66 28 20 4c 56 5b 76 5d 2b 31 3d 3d 4c 56 .if( LV[v]+1==LV
0780: 5b 75 5d 20 26 26 20 46 5b 76 5d 5b 75 5d 20 29 [u] && F[v][u] )
0790: 20 7b 0d 0a 09 09 09 09 46 6c 6f 77 20 66 20 3d {......Flow f =
07a0: 20 6d 69 6e 28 66 6c 6f 77 5f 69 6e 2d 66 6c 6f min(flow_in-flo
07b0: 77 5f 6f 75 74 2c 20 46 5b 76 5d 5b 75 5d 29 3b w_out, F[v][u]);
07c0: 0d 0a 09 09 09 09 69 66 28 20 75 3d 3d 44 20 7c ......if( u==D |
07d0: 7c 20 21 62 6c 6f 63 6b 65 64 5b 75 5d 20 26 26 | !blocked[u] &&
07e0: 20 28 66 3d 64 69 6e 69 63 5f 64 66 73 28 75 2c (f=dinic_dfs(u,
07f0: 44 2c 4c 56 2c 66 2c 62 6c 6f 63 6b 65 64 29 29 D,LV,f,blocked))
0800: 3e 30 20 29 20 7b 0d 0a 09 09 09 09 09 46 5b 76 >0 ) {.......F[v
0810: 5d 5b 75 5d 20 20 2d 3d 20 66 3b 0d 0a 09 09 09 ][u] -= f;.....
0820: 09 09 46 5b 75 5d 5b 76 5d 20 20 2b 3d 20 66 3b ..F[u][v] += f;
0830: 0d 0a 09 09 09 09 09 66 6c 6f 77 5f 6f 75 74 20 .......flow_out
0840: 2b 3d 20 66 3b 0d 0a 09 09 09 09 09 69 66 28 20 += f;.......if(
0850: 66 6c 6f 77 5f 69 6e 20 3d 3d 20 66 6c 6f 77 5f flow_in == flow_
0860: 6f 75 74 20 29 20 72 65 74 75 72 6e 20 66 6c 6f out ) return flo
0870: 77 5f 6f 75 74 3b 0d 0a 09 09 09 09 7d 0d 0a 09 w_out;......}...
0880: 09 09 7d 0d 0a 09 09 7d 0d 0a 09 09 62 6c 6f 63 ..}....}....bloc
0890: 6b 65 64 5b 76 5d 20 3d 20 28 66 6c 6f 77 5f 6f ked[v] = (flow_o
08a0: 75 74 3d 3d 30 29 3b 0d 0a 09 09 72 65 74 75 72 ut==0);....retur
08b0: 6e 20 66 6c 6f 77 5f 6f 75 74 3b 0d 0a 09 7d 0d n flow_out;...}.
08c0: 0a 7d 3b 0d 0a 0d 0a 0d 0a 74 79 70 65 64 65 66 .};......typedef
08d0: 20 63 6f 6d 70 6c 65 78 3c 69 6e 74 3e 20 43 4d complex<int> CM
08e0: 50 3b 0d 0a 64 6f 75 62 6c 65 20 6f 75 74 65 72 P;..double outer
08f0: 5f 70 72 6f 64 28 63 6f 6e 73 74 20 43 4d 50 26 _prod(const CMP&
0900: 20 61 2c 20 63 6f 6e 73 74 20 43 4d 50 26 20 62 a, const CMP& b
0910: 29 20 7b 20 72 65 74 75 72 6e 20 69 6d 61 67 28 ) { return imag(
0920: 63 6f 6e 6a 28 61 29 2a 62 29 3b 20 7d 0d 0a 64 conj(a)*b); }..d
0930: 6f 75 62 6c 65 20 69 6e 6e 65 72 5f 70 72 6f 64 ouble inner_prod
0940: 28 63 6f 6e 73 74 20 43 4d 50 26 20 61 2c 20 63 (const CMP& a, c
0950: 6f 6e 73 74 20 43 4d 50 26 20 62 29 20 7b 20 72 onst CMP& b) { r
0960: 65 74 75 72 6e 20 72 65 61 6c 28 63 6f 6e 6a 28 eturn real(conj(
0970: 61 29 2a 62 29 3b 20 7d 0d 0a 69 6e 74 20 63 63 a)*b); }..int cc
0980: 77 28 63 6f 6e 73 74 20 43 4d 50 26 20 61 2c 20 w(const CMP& a,
0990: 43 4d 50 20 62 2c 20 43 4d 50 20 63 29 20 7b 0d CMP b, CMP c) {.
09a0: 0a 09 62 20 2d 3d 20 61 3b 20 63 20 2d 3d 20 61 ..b -= a; c -= a
09b0: 3b 0d 0a 09 69 66 28 20 6f 75 74 65 72 5f 70 72 ;...if( outer_pr
09c0: 6f 64 28 62 2c 63 29 20 3e 20 30 20 29 20 72 65 od(b,c) > 0 ) re
09d0: 74 75 72 6e 20 2b 31 3b 20 2f 2f 20 63 6f 75 6e turn +1; // coun
09e0: 74 65 72 20 63 6c 6f 63 6b 77 69 73 65 0d 0a 09 ter clockwise...
09f0: 69 66 28 20 6f 75 74 65 72 5f 70 72 6f 64 28 62 if( outer_prod(b
0a00: 2c 63 29 20 3c 20 30 20 29 20 72 65 74 75 72 6e ,c) < 0 ) return
0a10: 20 2d 31 3b 20 2f 2f 20 63 6c 6f 63 6b 77 69 73 -1; // clockwis
0a20: 65 0d 0a 09 69 66 28 20 69 6e 6e 65 72 5f 70 72 e...if( inner_pr
0a30: 6f 64 28 62 2c 63 29 20 3c 20 30 20 29 20 72 65 od(b,c) < 0 ) re
0a40: 74 75 72 6e 20 2b 32 3b 20 2f 2f 20 63 2d 2d 5b turn +2; // c--[
0a50: 61 2d 2d 62 5d 20 6f 6e 20 6c 69 6e 65 0d 0a 09 a--b] on line...
0a60: 69 66 28 20 6e 6f 72 6d 28 62 29 20 3c 20 6e 6f if( norm(b) < no
0a70: 72 6d 28 63 29 20 29 20 20 20 72 65 74 75 72 6e rm(c) ) return
0a80: 20 2d 32 3b 20 2f 2f 20 5b 61 2d 2d 62 5d 2d 2d -2; // [a--b]--
0a90: 63 20 6f 6e 20 6c 69 6e 65 0d 0a 09 72 65 74 75 c on line...retu
0aa0: 72 6e 20 30 3b 20 2f 2f 20 5b 61 2d 2d 63 2d 2d rn 0; // [a--c--
0ab0: 62 5d 20 6f 6e 20 6c 69 6e 65 0d 0a 7d 0d 0a 0d b] on line..}...
0ac0: 0a 62 6f 6f 6c 20 63 72 6f 73 73 28 69 6e 74 20 .bool cross(int
0ad0: 78 31 2c 20 69 6e 74 20 79 31 2c 20 69 6e 74 20 x1, int y1, int
0ae0: 78 32 2c 20 69 6e 74 20 79 32 2c 0d 0a 20 20 20 x2, int y2,..
0af0: 20 20 20 20 20 20 20 20 69 6e 74 20 58 31 2c 20 int X1,
0b00: 69 6e 74 20 59 31 2c 20 69 6e 74 20 58 32 2c 20 int Y1, int X2,
0b10: 69 6e 74 20 59 32 29 20 7b 0d 0a 09 43 4d 50 20 int Y2) {...CMP
0b20: 70 31 28 78 31 2c 79 31 29 3b 0d 0a 09 43 4d 50 p1(x1,y1);...CMP
0b30: 20 70 32 28 78 32 2c 79 32 29 3b 0d 0a 09 43 4d p2(x2,y2);...CM
0b40: 50 20 50 31 28 58 31 2c 59 31 29 3b 0d 0a 09 43 P P1(X1,Y1);...C
0b50: 4d 50 20 50 32 28 58 32 2c 59 32 29 3b 0d 0a 09 MP P2(X2,Y2);...
0b60: 72 65 74 75 72 6e 20 63 63 77 28 70 31 2c 70 32 return ccw(p1,p2
0b70: 2c 50 31 29 2a 63 63 77 28 70 31 2c 70 32 2c 50 ,P1)*ccw(p1,p2,P
0b80: 32 29 3c 3d 30 20 26 26 20 63 63 77 28 50 31 2c 2)<=0 && ccw(P1,
0b90: 50 32 2c 70 31 29 2a 63 63 77 28 50 31 2c 50 32 P2,p1)*ccw(P1,P2
0ba0: 2c 70 32 29 3c 3d 30 3b 0d 0a 7d 0d 0a 0d 0a 63 ,p2)<=0;..}....c
0bb0: 6c 61 73 73 20 53 65 67 6d 65 6e 74 44 72 61 77 lass SegmentDraw
0bc0: 69 6e 67 20 7b 20 70 75 62 6c 69 63 3a 0d 0a 09 ing { public:...
0bd0: 65 6e 75 6d 20 54 41 47 20 7b 53 52 43 2c 20 4c enum TAG {SRC, L
0be0: 45 46 54 5f 52 2c 20 52 49 47 48 54 5f 52 2c 20 EFT_R, RIGHT_R,
0bf0: 4c 45 46 54 5f 42 2c 20 52 49 47 48 54 5f 42 2c LEFT_B, RIGHT_B,
0c00: 20 44 53 54 7d 3b 0d 0a 09 73 74 61 74 69 63 20 DST};...static
0c10: 63 6f 6e 73 74 20 69 6e 74 20 49 4e 46 20 3d 20 const int INF =
0c20: 30 78 33 66 66 66 66 66 66 66 3b 0d 0a 0d 0a 09 0x3fffffff;.....
0c30: 69 6e 74 20 6d 61 78 53 63 6f 72 65 28 76 65 63 int maxScore(vec
0c40: 74 6f 72 20 3c 69 6e 74 3e 20 78 2c 20 76 65 63 tor <int> x, vec
0c50: 74 6f 72 20 3c 69 6e 74 3e 20 79 2c 20 76 65 63 tor <int> y, vec
0c60: 74 6f 72 20 3c 69 6e 74 3e 20 72 65 64 53 63 6f tor <int> redSco
0c70: 72 65 2c 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e re, vector <int>
0c80: 20 62 6c 75 65 53 63 6f 72 65 29 0d 0a 09 7b 0d blueScore)...{.
0c90: 0a 09 09 63 6f 6e 73 74 20 69 6e 74 20 4e 20 3d ...const int N =
0ca0: 20 78 2e 73 69 7a 65 28 29 3b 0d 0a 0d 0a 09 09 x.size();......
0cb0: 76 65 63 74 6f 72 3c 76 65 63 74 6f 72 3c 62 6f vector<vector<bo
0cc0: 6f 6c 3e 3e 20 63 72 6f 73 73 5f 74 61 62 6c 65 ol>> cross_table
0cd0: 28 4e 2a 4e 2c 20 76 65 63 74 6f 72 3c 62 6f 6f (N*N, vector<boo
0ce0: 6c 3e 28 4e 2a 4e 29 29 3b 0d 0a 09 09 66 6f 72 l>(N*N));....for
0cf0: 28 69 6e 74 20 69 3d 30 3b 20 69 3c 4e 3b 20 2b (int i=0; i<N; +
0d00: 2b 69 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 6b +i)....for(int k
0d10: 3d 69 2b 31 3b 20 6b 3c 4e 3b 20 2b 2b 6b 29 0d =i+1; k<N; ++k).
0d20: 0a 09 09 66 6f 72 28 69 6e 74 20 69 69 3d 30 3b ...for(int ii=0;
0d30: 20 69 69 3c 4e 3b 20 2b 2b 69 69 29 0d 0a 09 09 ii<N; ++ii)....
0d40: 66 6f 72 28 69 6e 74 20 6b 6b 3d 69 69 2b 31 3b for(int kk=ii+1;
0d50: 20 6b 6b 3c 4e 3b 20 2b 2b 6b 6b 29 0d 0a 09 09 kk<N; ++kk)....
0d60: 09 63 72 6f 73 73 5f 74 61 62 6c 65 5b 69 2a 4e .cross_table[i*N
0d70: 2b 6b 5d 5b 69 69 2a 4e 2b 6b 6b 5d 20 3d 20 63 +k][ii*N+kk] = c
0d80: 72 6f 73 73 28 78 5b 69 5d 2c 79 5b 69 5d 2c 78 ross(x[i],y[i],x
0d90: 5b 6b 5d 2c 79 5b 6b 5d 2c 78 5b 69 69 5d 2c 79 [k],y[k],x[ii],y
0da0: 5b 69 69 5d 2c 78 5b 6b 6b 5d 2c 79 5b 6b 6b 5d [ii],x[kk],y[kk]
0db0: 29 3b 0d 0a 0d 0a 09 09 61 75 74 6f 2a 20 6d 66 );......auto* mf
0dc0: 20 3d 20 6e 65 77 20 4d 61 78 46 6c 6f 77 3c 70 = new MaxFlow<p
0dd0: 61 69 72 3c 54 41 47 2c 69 6e 74 3e 2c 20 4c 4c air<TAG,int>, LL
0de0: 3e 3b 0d 0a 0d 0a 09 09 69 6e 74 20 61 6c 6c 20 >;......int all
0df0: 3d 20 30 3b 0d 0a 09 09 66 6f 72 28 69 6e 74 20 = 0;....for(int
0e00: 69 3d 30 3b 20 69 3c 4e 3b 20 2b 2b 69 29 0d 0a i=0; i<N; ++i)..
0e10: 09 09 66 6f 72 28 69 6e 74 20 6b 3d 69 2b 31 3b ..for(int k=i+1;
0e20: 20 6b 3c 4e 3b 20 2b 2b 6b 29 20 7b 0d 0a 09 09 k<N; ++k) {....
0e30: 09 69 6e 74 20 70 20 3d 20 69 2a 4e 20 2b 20 6b .int p = i*N + k
0e40: 3b 0d 0a 09 09 09 6d 66 2d 3e 61 64 64 45 64 67 ;.....mf->addEdg
0e50: 65 28 6d 61 6b 65 5f 70 61 69 72 28 53 52 43 2c e(make_pair(SRC,
0e60: 30 29 2c 20 6d 61 6b 65 5f 70 61 69 72 28 4c 45 0), make_pair(LE
0e70: 46 54 5f 52 2c 70 29 2c 20 72 65 64 53 63 6f 72 FT_R,p), redScor
0e80: 65 5b 70 5d 29 3b 0d 0a 09 09 09 6d 66 2d 3e 61 e[p]);.....mf->a
0e90: 64 64 45 64 67 65 28 6d 61 6b 65 5f 70 61 69 72 ddEdge(make_pair
0ea0: 28 4c 45 46 54 5f 52 2c 70 29 2c 20 6d 61 6b 65 (LEFT_R,p), make
0eb0: 5f 70 61 69 72 28 52 49 47 48 54 5f 52 2c 70 29 _pair(RIGHT_R,p)
0ec0: 2c 20 49 4e 46 29 3b 0d 0a 09 09 09 6d 66 2d 3e , INF);.....mf->
0ed0: 61 64 64 45 64 67 65 28 6d 61 6b 65 5f 70 61 69 addEdge(make_pai
0ee0: 72 28 52 49 47 48 54 5f 52 2c 70 29 2c 20 6d 61 r(RIGHT_R,p), ma
0ef0: 6b 65 5f 70 61 69 72 28 44 53 54 2c 30 29 2c 20 ke_pair(DST,0),
0f00: 30 29 3b 0d 0a 09 09 09 6d 66 2d 3e 61 64 64 45 0);.....mf->addE
0f10: 64 67 65 28 6d 61 6b 65 5f 70 61 69 72 28 53 52 dge(make_pair(SR
0f20: 43 2c 30 29 2c 20 6d 61 6b 65 5f 70 61 69 72 28 C,0), make_pair(
0f30: 4c 45 46 54 5f 42 2c 70 29 2c 20 30 29 3b 0d 0a LEFT_B,p), 0);..
0f40: 09 09 09 6d 66 2d 3e 61 64 64 45 64 67 65 28 6d ...mf->addEdge(m
0f50: 61 6b 65 5f 70 61 69 72 28 4c 45 46 54 5f 42 2c ake_pair(LEFT_B,
0f60: 70 29 2c 20 6d 61 6b 65 5f 70 61 69 72 28 52 49 p), make_pair(RI
0f70: 47 48 54 5f 42 2c 70 29 2c 20 49 4e 46 29 3b 0d GHT_B,p), INF);.
0f80: 0a 09 09 09 6d 66 2d 3e 61 64 64 45 64 67 65 28 ....mf->addEdge(
0f90: 6d 61 6b 65 5f 70 61 69 72 28 52 49 47 48 54 5f make_pair(RIGHT_
0fa0: 42 2c 70 29 2c 20 6d 61 6b 65 5f 70 61 69 72 28 B,p), make_pair(
0fb0: 44 53 54 2c 30 29 2c 20 62 6c 75 65 53 63 6f 72 DST,0), blueScor
0fc0: 65 5b 70 5d 29 3b 0d 0a 09 09 09 61 6c 6c 20 2b e[p]);.....all +
0fd0: 3d 20 72 65 64 53 63 6f 72 65 5b 70 5d 3b 0d 0a = redScore[p];..
0fe0: 09 09 09 61 6c 6c 20 2b 3d 20 62 6c 75 65 53 63 ...all += blueSc
0ff0: 6f 72 65 5b 70 5d 3b 0d 0a 09 09 7d 0d 0a 0d 0a ore[p];....}....
1000: 09 09 66 6f 72 28 69 6e 74 20 69 3d 30 3b 20 69 ..for(int i=0; i
1010: 3c 4e 3b 20 2b 2b 69 29 0d 0a 09 09 66 6f 72 28 <N; ++i)....for(
1020: 69 6e 74 20 6b 3d 69 2b 31 3b 20 6b 3c 4e 3b 20 int k=i+1; k<N;
1030: 2b 2b 6b 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 ++k)....for(int
1040: 69 69 3d 30 3b 20 69 69 3c 4e 3b 20 2b 2b 69 69 ii=0; ii<N; ++ii
1050: 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 6b 6b 3d )....for(int kk=
1060: 69 69 2b 31 3b 20 6b 6b 3c 4e 3b 20 2b 2b 6b 6b ii+1; kk<N; ++kk
1070: 29 20 7b 0d 0a 09 09 09 69 6e 74 20 72 70 20 3d ) {.....int rp =
1080: 20 69 2a 4e 20 2b 20 6b 3b 0d 0a 09 09 09 69 6e i*N + k;.....in
1090: 74 20 62 70 20 3d 20 69 69 2a 4e 20 2b 20 6b 6b t bp = ii*N + kk
10a0: 3b 0d 0a 09 09 09 69 66 28 63 72 6f 73 73 5f 74 ;.....if(cross_t
10b0: 61 62 6c 65 5b 72 70 5d 5b 62 70 5d 29 0d 0a 09 able[rp][bp])...
10c0: 09 09 09 6d 66 2d 3e 61 64 64 45 64 67 65 28 6d ...mf->addEdge(m
10d0: 61 6b 65 5f 70 61 69 72 28 52 49 47 48 54 5f 52 ake_pair(RIGHT_R
10e0: 2c 72 70 29 2c 20 6d 61 6b 65 5f 70 61 69 72 28 ,rp), make_pair(
10f0: 4c 45 46 54 5f 42 2c 62 70 29 2c 20 49 4e 46 29 LEFT_B,bp), INF)
1100: 3b 0d 0a 09 09 7d 0d 0a 0d 0a 09 09 4c 4c 20 66 ;....}......LL f
1110: 6c 6f 77 20 3d 20 6d 66 2d 3e 63 61 6c 63 28 6d low = mf->calc(m
1120: 61 6b 65 5f 70 61 69 72 28 53 52 43 2c 30 29 2c ake_pair(SRC,0),
1130: 20 6d 61 6b 65 5f 70 61 69 72 28 44 53 54 2c 30 make_pair(DST,0
1140: 29 29 3b 0d 0a 09 09 64 65 6c 65 74 65 20 6d 66 ));....delete mf
1150: 3b 0d 0a 09 09 72 65 74 75 72 6e 20 61 6c 6c 20 ;....return all
1160: 2d 20 66 6c 6f 77 3b 0d 0a 09 7d 0d 0a 7d 3b 0d - flow;...}..};.
1170: 0a 0d 0a 2f 2f 20 42 45 47 49 4e 20 43 55 54 20 ...// BEGIN CUT
1180: 48 45 52 45 0d 0a 23 69 6e 63 6c 75 64 65 20 3c HERE..#include <
1190: 63 74 69 6d 65 3e 0d 0a 64 6f 75 62 6c 65 20 73 ctime>..double s
11a0: 74 61 72 74 5f 74 69 6d 65 3b 20 73 74 72 69 6e tart_time; strin
11b0: 67 20 74 69 6d 65 72 28 29 0d 0a 20 7b 20 6f 73 g timer().. { os
11c0: 74 72 69 6e 67 73 74 72 65 61 6d 20 6f 73 3b 20 tringstream os;
11d0: 6f 73 20 3c 3c 20 22 20 28 22 20 3c 3c 20 69 6e os << " (" << in
11e0: 74 28 28 63 6c 6f 63 6b 28 29 2d 73 74 61 72 74 t((clock()-start
11f0: 5f 74 69 6d 65 29 2f 43 4c 4f 43 4b 53 5f 50 45 _time)/CLOCKS_PE
1200: 52 5f 53 45 43 2a 31 30 30 30 29 20 3c 3c 20 22 R_SEC*1000) << "
1210: 20 6d 73 65 63 29 22 3b 20 72 65 74 75 72 6e 20 msec)"; return
1220: 6f 73 2e 73 74 72 28 29 3b 20 7d 0d 0a 74 65 6d os.str(); }..tem
1230: 70 6c 61 74 65 3c 74 79 70 65 6e 61 6d 65 20 54 plate<typename T
1240: 3e 20 6f 73 74 72 65 61 6d 26 20 6f 70 65 72 61 > ostream& opera
1250: 74 6f 72 3c 3c 28 6f 73 74 72 65 61 6d 26 20 6f tor<<(ostream& o
1260: 73 2c 20 63 6f 6e 73 74 20 76 65 63 74 6f 72 3c s, const vector<
1270: 54 3e 26 20 76 29 0d 0a 20 7b 20 6f 73 20 3c 3c T>& v).. { os <<
1280: 20 22 7b 20 22 3b 0d 0a 20 20 20 66 6f 72 28 74 "{ ";.. for(t
1290: 79 70 65 6e 61 6d 65 20 76 65 63 74 6f 72 3c 54 ypename vector<T
12a0: 3e 3a 3a 63 6f 6e 73 74 5f 69 74 65 72 61 74 6f >::const_iterato
12b0: 72 20 69 74 3d 76 2e 62 65 67 69 6e 28 29 3b 20 r it=v.begin();
12c0: 69 74 21 3d 76 2e 65 6e 64 28 29 3b 20 2b 2b 69 it!=v.end(); ++i
12d0: 74 29 0d 0a 20 20 20 6f 73 20 3c 3c 20 27 5c 22 t).. os << '\"
12e0: 27 20 3c 3c 20 2a 69 74 20 3c 3c 20 27 5c 22 27 ' << *it << '\"'
12f0: 20 3c 3c 20 28 69 74 2b 31 3d 3d 76 2e 65 6e 64 << (it+1==v.end
1300: 28 29 20 3f 20 22 22 20 3a 20 22 2c 20 22 29 3b () ? "" : ", ");
1310: 20 6f 73 20 3c 3c 20 22 20 7d 22 3b 20 72 65 74 os << " }"; ret
1320: 75 72 6e 20 6f 73 3b 20 7d 0d 0a 76 6f 69 64 20 urn os; }..void
1330: 76 65 72 69 66 79 5f 63 61 73 65 28 63 6f 6e 73 verify_case(cons
1340: 74 20 69 6e 74 26 20 45 78 70 65 63 74 65 64 2c t int& Expected,
1350: 20 63 6f 6e 73 74 20 69 6e 74 26 20 52 65 63 65 const int& Rece
1360: 69 76 65 64 29 20 7b 0d 0a 20 62 6f 6f 6c 20 6f ived) {.. bool o
1370: 6b 20 3d 20 28 45 78 70 65 63 74 65 64 20 3d 3d k = (Expected ==
1380: 20 52 65 63 65 69 76 65 64 29 3b 0d 0a 20 69 66 Received);.. if
1390: 28 6f 6b 29 20 63 65 72 72 20 3c 3c 20 22 50 41 (ok) cerr << "PA
13a0: 53 53 45 44 22 20 3c 3c 20 74 69 6d 65 72 28 29 SSED" << timer()
13b0: 20 3c 3c 20 65 6e 64 6c 3b 20 20 65 6c 73 65 20 << endl; else
13c0: 7b 20 63 65 72 72 20 3c 3c 20 22 46 41 49 4c 45 { cerr << "FAILE
13d0: 44 22 20 3c 3c 20 74 69 6d 65 72 28 29 20 3c 3c D" << timer() <<
13e0: 20 65 6e 64 6c 3b 0d 0a 20 63 65 72 72 20 3c 3c endl;.. cerr <<
13f0: 20 22 5c 74 6f 3a 20 5c 22 22 20 3c 3c 20 45 78 "\to: \"" << Ex
1400: 70 65 63 74 65 64 20 3c 3c 20 27 5c 22 27 20 3c pected << '\"' <
1410: 3c 20 65 6e 64 6c 20 3c 3c 20 22 5c 74 78 3a 20 < endl << "\tx:
1420: 5c 22 22 20 3c 3c 20 52 65 63 65 69 76 65 64 20 \"" << Received
1430: 3c 3c 20 27 5c 22 27 20 3c 3c 20 65 6e 64 6c 3b << '\"' << endl;
1440: 20 7d 20 7d 0d 0a 23 64 65 66 69 6e 65 20 43 41 } }..#define CA
1450: 53 45 28 4e 29 20 7b 63 65 72 72 20 3c 3c 20 22 SE(N) {cerr << "
1460: 54 65 73 74 20 43 61 73 65 20 23 22 20 3c 3c 20 Test Case #" <<
1470: 4e 20 3c 3c 20 22 2e 2e 2e 22 20 3c 3c 20 66 6c N << "..." << fl
1480: 75 73 68 3b 20 73 74 61 72 74 5f 74 69 6d 65 3d ush; start_time=
1490: 63 6c 6f 63 6b 28 29 3b 0d 0a 23 64 65 66 69 6e clock();..#defin
14a0: 65 20 45 4e 44 09 20 76 65 72 69 66 79 5f 63 61 e END. verify_ca
14b0: 73 65 28 5f 2c 20 53 65 67 6d 65 6e 74 44 72 61 se(_, SegmentDra
14c0: 77 69 6e 67 28 29 2e 6d 61 78 53 63 6f 72 65 28 wing().maxScore(
14d0: 78 2c 20 79 2c 20 72 65 64 53 63 6f 72 65 2c 20 x, y, redScore,
14e0: 62 6c 75 65 53 63 6f 72 65 29 29 3b 7d 0d 0a 69 blueScore));}..i
14f0: 6e 74 20 6d 61 69 6e 28 29 7b 0d 0a 0d 0a 43 41 nt main(){....CA
1500: 53 45 28 30 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d SE(0)...int x_[]
1510: 20 3d 20 7b 30 2c 31 2c 30 2c 2d 31 7d 3b 0d 0a = {0,1,0,-1};..
1520: 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 . vector <int>
1530: 78 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 x(x_, x_+sizeof(
1540: 78 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 x_)/sizeof(*x_))
1550: 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 ; ...int y_[] =
1560: 7b 31 2c 30 2c 2d 31 2c 30 7d 3b 0d 0a 09 20 20 {1,0,-1,0};...
1570: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79 vector <int> y(y
1580: 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 _, y_+sizeof(y_)
1590: 2f 73 69 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d /sizeof(*y_)); .
15a0: 0a 09 69 6e 74 20 72 65 64 53 63 6f 72 65 5f 5b ..int redScore_[
15b0: 5d 20 3d 20 7b 30 2c 20 31 2c 20 32 2c 20 33 2c ] = {0, 1, 2, 3,
15c0: 0d 0a 20 31 2c 20 30 2c 20 36 2c 20 34 2c 0d 0a .. 1, 0, 6, 4,..
15d0: 20 32 2c 20 36 2c 20 30 2c 20 35 2c 0d 0a 20 33 2, 6, 0, 5,.. 3
15e0: 2c 20 34 2c 20 35 2c 20 30 7d 3b 0d 0a 09 20 20 , 4, 5, 0};...
15f0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 72 65 64 vector <int> red
1600: 53 63 6f 72 65 28 72 65 64 53 63 6f 72 65 5f 2c Score(redScore_,
1610: 20 72 65 64 53 63 6f 72 65 5f 2b 73 69 7a 65 6f redScore_+sizeo
1620: 66 28 72 65 64 53 63 6f 72 65 5f 29 2f 73 69 7a f(redScore_)/siz
1630: 65 6f 66 28 2a 72 65 64 53 63 6f 72 65 5f 29 29 eof(*redScore_))
1640: 3b 20 0d 0a 09 69 6e 74 20 62 6c 75 65 53 63 6f ; ...int blueSco
1650: 72 65 5f 5b 5d 20 3d 20 7b 30 2c 20 32 2c 20 33 re_[] = {0, 2, 3
1660: 2c 20 37 2c 0d 0a 20 32 2c 20 30 2c 20 34 2c 20 , 7,.. 2, 0, 4,
1670: 36 2c 0d 0a 20 33 2c 20 34 2c 20 30 2c 20 35 2c 6,.. 3, 4, 0, 5,
1680: 0d 0a 20 37 2c 20 36 2c 20 35 2c 20 30 7d 3b 0d .. 7, 6, 5, 0};.
1690: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
16a0: 20 62 6c 75 65 53 63 6f 72 65 28 62 6c 75 65 53 blueScore(blueS
16b0: 63 6f 72 65 5f 2c 20 62 6c 75 65 53 63 6f 72 65 core_, blueScore
16c0: 5f 2b 73 69 7a 65 6f 66 28 62 6c 75 65 53 63 6f _+sizeof(blueSco
16d0: 72 65 5f 29 2f 73 69 7a 65 6f 66 28 2a 62 6c 75 re_)/sizeof(*blu
16e0: 65 53 63 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 6e eScore_)); ...in
16f0: 74 20 5f 20 3d 20 32 37 3b 20 0d 0a 45 4e 44 0d t _ = 27; ..END.
1700: 0a 43 41 53 45 28 31 29 0d 0a 09 69 6e 74 20 78 .CASE(1)...int x
1710: 5f 5b 5d 20 3d 20 7b 30 2c 20 31 7d 3b 0d 0a 09 _[] = {0, 1};...
1720: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 78 vector <int> x
1730: 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 78 (x_, x_+sizeof(x
1740: 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 3b _)/sizeof(*x_));
1750: 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 7b ...int y_[] = {
1760: 31 2c 20 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 1, 0};... vecto
1770: 72 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f r <int> y(y_, y_
1780: 2b 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 +sizeof(y_)/size
1790: 6f 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 of(*y_)); ...int
17a0: 20 72 65 64 53 63 6f 72 65 5f 5b 5d 20 3d 20 7b redScore_[] = {
17b0: 30 2c 20 31 30 31 2c 20 31 30 31 2c 20 30 7d 3b 0, 101, 101, 0};
17c0: 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 ... vector <int
17d0: 3e 20 72 65 64 53 63 6f 72 65 28 72 65 64 53 63 > redScore(redSc
17e0: 6f 72 65 5f 2c 20 72 65 64 53 63 6f 72 65 5f 2b ore_, redScore_+
17f0: 73 69 7a 65 6f 66 28 72 65 64 53 63 6f 72 65 5f sizeof(redScore_
1800: 29 2f 73 69 7a 65 6f 66 28 2a 72 65 64 53 63 6f )/sizeof(*redSco
1810: 72 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 62 6c re_)); ...int bl
1820: 75 65 53 63 6f 72 65 5f 5b 5d 20 3d 20 7b 30 2c ueScore_[] = {0,
1830: 20 31 30 30 2c 20 31 30 30 2c 20 30 7d 3b 0d 0a 100, 100, 0};..
1840: 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 . vector <int>
1850: 62 6c 75 65 53 63 6f 72 65 28 62 6c 75 65 53 63 blueScore(blueSc
1860: 6f 72 65 5f 2c 20 62 6c 75 65 53 63 6f 72 65 5f ore_, blueScore_
1870: 2b 73 69 7a 65 6f 66 28 62 6c 75 65 53 63 6f 72 +sizeof(blueScor
1880: 65 5f 29 2f 73 69 7a 65 6f 66 28 2a 62 6c 75 65 e_)/sizeof(*blue
1890: 53 63 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 Score_)); ...int
18a0: 20 5f 20 3d 20 31 30 31 3b 20 0d 0a 45 4e 44 0d _ = 101; ..END.
18b0: 0a 43 41 53 45 28 32 29 0d 0a 09 69 6e 74 20 78 .CASE(2)...int x
18c0: 5f 5b 5d 20 3d 20 7b 2d 33 2c 20 2d 31 2c 20 2d _[] = {-3, -1, -
18d0: 31 2c 20 20 31 2c 20 20 31 2c 20 20 33 7d 3b 0d 1, 1, 1, 3};.
18e0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
18f0: 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 x(x_, x_+sizeof
1900: 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 (x_)/sizeof(*x_)
1910: 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d ); ...int y_[] =
1920: 20 7b 20 30 2c 20 2d 32 2c 20 20 32 2c 20 2d 32 { 0, -2, 2, -2
1930: 2c 20 20 32 2c 20 20 30 7d 3b 0d 0a 09 20 20 76 , 2, 0};... v
1940: 65 63 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79 5f ector <int> y(y_
1950: 2c 20 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 2f , y_+sizeof(y_)/
1960: 73 69 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d 0a sizeof(*y_)); ..
1970: 09 69 6e 74 20 72 65 64 53 63 6f 72 65 5f 5b 5d .int redScore_[]
1980: 20 3d 20 7b 30 2c 20 32 2c 20 31 2c 20 32 2c 20 = {0, 2, 1, 2,
1990: 31 2c 20 32 2c 0d 0a 20 32 2c 20 30 2c 20 32 2c 1, 2,.. 2, 0, 2,
19a0: 20 31 2c 20 32 2c 20 31 2c 0d 0a 20 31 2c 20 32 1, 2, 1,.. 1, 2
19b0: 2c 20 30 2c 20 32 2c 20 31 2c 20 32 2c 0d 0a 20 , 0, 2, 1, 2,..
19c0: 32 2c 20 31 2c 20 32 2c 20 30 2c 20 32 2c 20 31 2, 1, 2, 0, 2, 1
19d0: 2c 0d 0a 20 31 2c 20 32 2c 20 31 2c 20 32 2c 20 ,.. 1, 2, 1, 2,
19e0: 30 2c 20 32 2c 0d 0a 20 32 2c 20 31 2c 20 32 2c 0, 2,.. 2, 1, 2,
19f0: 20 31 2c 20 32 2c 20 30 7d 3b 0d 0a 09 20 20 76 1, 2, 0};... v
1a00: 65 63 74 6f 72 20 3c 69 6e 74 3e 20 72 65 64 53 ector <int> redS
1a10: 63 6f 72 65 28 72 65 64 53 63 6f 72 65 5f 2c 20 core(redScore_,
1a20: 72 65 64 53 63 6f 72 65 5f 2b 73 69 7a 65 6f 66 redScore_+sizeof
1a30: 28 72 65 64 53 63 6f 72 65 5f 29 2f 73 69 7a 65 (redScore_)/size
1a40: 6f 66 28 2a 72 65 64 53 63 6f 72 65 5f 29 29 3b of(*redScore_));
1a50: 20 0d 0a 09 69 6e 74 20 62 6c 75 65 53 63 6f 72 ...int blueScor
1a60: 65 5f 5b 5d 20 3d 20 7b 30 2c 20 30 2c 20 30 2c e_[] = {0, 0, 0,
1a70: 20 30 2c 20 30 2c 20 30 2c 0d 0a 20 30 2c 20 30 0, 0, 0,.. 0, 0
1a80: 2c 20 30 2c 20 30 2c 20 30 2c 20 30 2c 0d 0a 20 , 0, 0, 0, 0,..
1a90: 30 2c 20 30 2c 20 30 2c 20 32 31 2c 20 30 2c 20 0, 0, 0, 21, 0,
1aa0: 30 2c 0d 0a 20 30 2c 20 30 2c 20 32 31 2c 20 30 0,.. 0, 0, 21, 0
1ab0: 2c 20 30 2c 20 30 2c 0d 0a 20 30 2c 20 30 2c 20 , 0, 0,.. 0, 0,
1ac0: 30 2c 20 30 2c 20 30 2c 20 30 2c 0d 0a 20 30 2c 0, 0, 0, 0,.. 0,
1ad0: 20 30 2c 20 30 2c 20 30 2c 20 30 2c 20 30 7d 3b 0, 0, 0, 0, 0};
1ae0: 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 ... vector <int
1af0: 3e 20 62 6c 75 65 53 63 6f 72 65 28 62 6c 75 65 > blueScore(blue
1b00: 53 63 6f 72 65 5f 2c 20 62 6c 75 65 53 63 6f 72 Score_, blueScor
1b10: 65 5f 2b 73 69 7a 65 6f 66 28 62 6c 75 65 53 63 e_+sizeof(blueSc
1b20: 6f 72 65 5f 29 2f 73 69 7a 65 6f 66 28 2a 62 6c ore_)/sizeof(*bl
1b30: 75 65 53 63 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 ueScore_)); ...i
1b40: 6e 74 20 5f 20 3d 20 32 35 3b 20 0d 0a 45 4e 44 nt _ = 25; ..END
1b50: 0d 0a 43 41 53 45 28 33 29 0d 0a 09 69 6e 74 20 ..CASE(3)...int
1b60: 78 5f 5b 5d 20 3d 20 7b 2d 31 30 30 2c 20 31 30 x_[] = {-100, 10
1b70: 30 2c 20 30 2c 20 2d 31 30 2c 20 31 30 2c 20 30 0, 0, -10, 10, 0
1b80: 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 };... vector <i
1b90: 6e 74 3e 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a nt> x(x_, x_+siz
1ba0: 65 6f 66 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a eof(x_)/sizeof(*
1bb0: 78 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b x_)); ...int y_[
1bc0: 5d 20 3d 20 7b 30 2c 20 30 2c 20 31 30 30 2c 20 ] = {0, 0, 100,
1bd0: 31 30 2c 20 31 30 2c 20 31 7d 3b 0d 0a 09 20 20 10, 10, 1};...
1be0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79 vector <int> y(y
1bf0: 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 _, y_+sizeof(y_)
1c00: 2f 73 69 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d /sizeof(*y_)); .
1c10: 0a 09 69 6e 74 20 72 65 64 53 63 6f 72 65 5f 5b ..int redScore_[
1c20: 5d 20 3d 20 7b 20 30 2c 20 39 36 2c 20 39 36 2c ] = { 0, 96, 96,
1c30: 20 32 35 2c 20 32 35 2c 20 32 35 2c 0d 0a 20 39 25, 25, 25,.. 9
1c40: 36 2c 20 20 30 2c 20 39 36 2c 20 32 35 2c 20 32 6, 0, 96, 25, 2
1c50: 35 2c 20 32 35 2c 0d 0a 20 39 36 2c 20 39 36 2c 5, 25,.. 96, 96,
1c60: 20 20 30 2c 20 32 35 2c 20 32 35 2c 20 32 35 2c 0, 25, 25, 25,
1c70: 0d 0a 20 32 35 2c 20 32 35 2c 20 32 35 2c 20 20 .. 25, 25, 25,
1c80: 30 2c 20 31 30 2c 20 31 30 2c 0d 0a 20 32 35 2c 0, 10, 10,.. 25,
1c90: 20 32 35 2c 20 32 35 2c 20 31 30 2c 20 20 30 2c 25, 25, 10, 0,
1ca0: 20 31 30 2c 0d 0a 20 32 35 2c 20 32 35 2c 20 32 10,.. 25, 25, 2
1cb0: 35 2c 20 31 30 2c 20 31 30 2c 20 20 30 7d 3b 0d 5, 10, 10, 0};.
1cc0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
1cd0: 20 72 65 64 53 63 6f 72 65 28 72 65 64 53 63 6f redScore(redSco
1ce0: 72 65 5f 2c 20 72 65 64 53 63 6f 72 65 5f 2b 73 re_, redScore_+s
1cf0: 69 7a 65 6f 66 28 72 65 64 53 63 6f 72 65 5f 29 izeof(redScore_)
1d00: 2f 73 69 7a 65 6f 66 28 2a 72 65 64 53 63 6f 72 /sizeof(*redScor
1d10: 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 62 6c 75 e_)); ...int blu
1d20: 65 53 63 6f 72 65 5f 5b 5d 20 3d 20 7b 20 30 2c eScore_[] = { 0,
1d30: 20 33 30 2c 20 33 30 2c 20 32 30 2c 20 32 30 2c 30, 30, 20, 20,
1d40: 20 32 30 2c 0d 0a 20 33 30 2c 20 20 30 2c 20 33 20,.. 30, 0, 3
1d50: 30 2c 20 32 30 2c 20 32 30 2c 20 32 30 2c 0d 0a 0, 20, 20, 20,..
1d60: 20 33 30 2c 20 33 30 2c 20 20 30 2c 20 32 30 2c 30, 30, 0, 20,
1d70: 20 32 30 2c 20 32 30 2c 0d 0a 20 32 30 2c 20 32 20, 20,.. 20, 2
1d80: 30 2c 20 32 30 2c 20 20 30 2c 20 38 36 2c 20 38 0, 20, 0, 86, 8
1d90: 36 2c 0d 0a 20 32 30 2c 20 32 30 2c 20 32 30 2c 6,.. 20, 20, 20,
1da0: 20 38 36 2c 20 20 30 2c 20 38 36 2c 0d 0a 20 32 86, 0, 86,.. 2
1db0: 30 2c 20 32 30 2c 20 32 30 2c 20 38 36 2c 20 38 0, 20, 20, 86, 8
1dc0: 36 2c 20 20 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6, 0};... vect
1dd0: 6f 72 20 3c 69 6e 74 3e 20 62 6c 75 65 53 63 6f or <int> blueSco
1de0: 72 65 28 62 6c 75 65 53 63 6f 72 65 5f 2c 20 62 re(blueScore_, b
1df0: 6c 75 65 53 63 6f 72 65 5f 2b 73 69 7a 65 6f 66 lueScore_+sizeof
1e00: 28 62 6c 75 65 53 63 6f 72 65 5f 29 2f 73 69 7a (blueScore_)/siz
1e10: 65 6f 66 28 2a 62 6c 75 65 53 63 6f 72 65 5f 29 eof(*blueScore_)
1e20: 29 3b 20 0d 0a 09 69 6e 74 20 5f 20 3d 20 35 34 ); ...int _ = 54
1e30: 36 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 34 6; ..END..CASE(4
1e40: 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d 20 7b )...int x_[] = {
1e50: 31 2c 20 32 2c 20 33 2c 20 34 2c 20 35 2c 20 36 1, 2, 3, 4, 5, 6
1e60: 2c 20 37 2c 20 38 2c 20 39 2c 20 31 30 7d 3b 0d , 7, 8, 9, 10};.
1e70: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
1e80: 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 x(x_, x_+sizeof
1e90: 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 (x_)/sizeof(*x_)
1ea0: 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d ); ...int y_[] =
1eb0: 20 7b 31 2c 20 34 2c 20 39 2c 20 31 36 2c 20 32 {1, 4, 9, 16, 2
1ec0: 35 2c 20 33 36 2c 20 34 39 2c 20 36 34 2c 20 38 5, 36, 49, 64, 8
1ed0: 31 2c 20 31 30 30 7d 3b 0d 0a 09 20 20 76 65 63 1, 100};... vec
1ee0: 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 tor <int> y(y_,
1ef0: 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69 y_+sizeof(y_)/si
1f00: 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 zeof(*y_)); ...i
1f10: 6e 74 20 72 65 64 53 63 6f 72 65 5f 5b 5d 20 3d nt redScore_[] =
1f20: 20 7b 30 2c 20 31 35 2c 20 32 2c 20 33 2c 20 34 {0, 15, 2, 3, 4
1f30: 2c 20 35 2c 20 36 2c 20 37 2c 20 38 2c 20 39 2c , 5, 6, 7, 8, 9,
1f40: 0d 0a 20 31 35 2c 20 30 2c 20 31 35 2c 20 32 2c .. 15, 0, 15, 2,
1f50: 20 33 2c 20 34 2c 20 35 2c 20 36 2c 20 37 2c 20 3, 4, 5, 6, 7,
1f60: 38 2c 0d 0a 20 32 2c 20 31 35 2c 20 30 2c 20 31 8,.. 2, 15, 0, 1
1f70: 35 2c 20 32 2c 20 33 2c 20 34 2c 20 35 2c 20 36 5, 2, 3, 4, 5, 6
1f80: 2c 20 37 2c 0d 0a 20 33 2c 20 32 2c 20 31 35 2c , 7,.. 3, 2, 15,
1f90: 20 30 2c 20 31 35 2c 20 32 2c 20 33 2c 20 34 2c 0, 15, 2, 3, 4,
1fa0: 20 35 2c 20 36 2c 0d 0a 20 34 2c 20 33 2c 20 32 5, 6,.. 4, 3, 2
1fb0: 2c 20 31 35 2c 20 30 2c 20 31 35 2c 20 32 2c 20 , 15, 0, 15, 2,
1fc0: 33 2c 20 34 2c 20 35 2c 0d 0a 20 35 2c 20 34 2c 3, 4, 5,.. 5, 4,
1fd0: 20 33 2c 20 32 2c 20 31 35 2c 20 30 2c 20 31 35 3, 2, 15, 0, 15
1fe0: 2c 20 32 2c 20 33 2c 20 34 2c 0d 0a 20 36 2c 20 , 2, 3, 4,.. 6,
1ff0: 35 2c 20 34 2c 20 33 2c 20 32 2c 20 31 35 2c 20 5, 4, 3, 2, 15,
2000: 30 2c 20 31 35 2c 20 32 2c 20 33 2c 0d 0a 20 37 0, 15, 2, 3,.. 7
2010: 2c 20 36 2c 20 35 2c 20 34 2c 20 33 2c 20 32 2c , 6, 5, 4, 3, 2,
2020: 20 31 35 2c 20 30 2c 20 31 35 2c 20 32 2c 0d 0a 15, 0, 15, 2,..
2030: 20 38 2c 20 37 2c 20 36 2c 20 35 2c 20 34 2c 20 8, 7, 6, 5, 4,
2040: 33 2c 20 32 2c 20 31 35 2c 20 30 2c 20 31 35 2c 3, 2, 15, 0, 15,
2050: 0d 0a 20 39 2c 20 38 2c 20 37 2c 20 36 2c 20 35 .. 9, 8, 7, 6, 5
2060: 2c 20 34 2c 20 33 2c 20 32 2c 20 31 35 2c 20 30 , 4, 3, 2, 15, 0
2070: 7d 0d 0a 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 }..;... vector
2080: 3c 69 6e 74 3e 20 72 65 64 53 63 6f 72 65 28 72 <int> redScore(r
2090: 65 64 53 63 6f 72 65 5f 2c 20 72 65 64 53 63 6f edScore_, redSco
20a0: 72 65 5f 2b 73 69 7a 65 6f 66 28 72 65 64 53 63 re_+sizeof(redSc
20b0: 6f 72 65 5f 29 2f 73 69 7a 65 6f 66 28 2a 72 65 ore_)/sizeof(*re
20c0: 64 53 63 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 6e dScore_)); ...in
20d0: 74 20 62 6c 75 65 53 63 6f 72 65 5f 5b 5d 20 3d t blueScore_[] =
20e0: 20 7b 30 2c 20 30 2c 20 32 2c 20 33 2c 20 34 2c {0, 0, 2, 3, 4,
20f0: 20 35 2c 20 36 2c 20 37 2c 20 38 2c 20 39 2c 0d 5, 6, 7, 8, 9,.
2100: 0a 20 30 2c 20 30 2c 20 30 2c 20 32 2c 20 33 2c . 0, 0, 0, 2, 3,
2110: 20 34 2c 20 35 2c 20 36 2c 20 37 2c 20 38 2c 0d 4, 5, 6, 7, 8,.
2120: 0a 20 32 2c 20 30 2c 20 30 2c 20 30 2c 20 32 2c . 2, 0, 0, 0, 2,
2130: 20 33 2c 20 34 2c 20 35 2c 20 36 2c 20 37 2c 0d 3, 4, 5, 6, 7,.
2140: 0a 20 33 2c 20 32 2c 20 30 2c 20 30 2c 20 30 2c . 3, 2, 0, 0, 0,
2150: 20 32 2c 20 33 2c 20 34 2c 20 35 2c 20 36 2c 0d 2, 3, 4, 5, 6,.
2160: 0a 20 34 2c 20 33 2c 20 32 2c 20 30 2c 20 30 2c . 4, 3, 2, 0, 0,
2170: 20 31 30 30 2c 20 32 2c 20 33 2c 20 34 2c 20 35 100, 2, 3, 4, 5
2180: 2c 0d 0a 20 35 2c 20 34 2c 20 33 2c 20 32 2c 20 ,.. 5, 4, 3, 2,
2190: 31 30 30 2c 20 30 2c 20 30 2c 20 32 2c 20 33 2c 100, 0, 0, 2, 3,
21a0: 20 34 2c 0d 0a 20 36 2c 20 35 2c 20 34 2c 20 33 4,.. 6, 5, 4, 3
21b0: 2c 20 32 2c 20 30 2c 20 30 2c 20 30 2c 20 32 2c , 2, 0, 0, 0, 2,
21c0: 20 33 2c 0d 0a 20 37 2c 20 36 2c 20 35 2c 20 34 3,.. 7, 6, 5, 4
21d0: 2c 20 33 2c 20 32 2c 20 30 2c 20 30 2c 20 30 2c , 3, 2, 0, 0, 0,
21e0: 20 32 2c 0d 0a 20 38 2c 20 37 2c 20 36 2c 20 35 2,.. 8, 7, 6, 5
21f0: 2c 20 34 2c 20 33 2c 20 32 2c 20 30 2c 20 30 2c , 4, 3, 2, 0, 0,
2200: 20 30 2c 0d 0a 20 39 2c 20 38 2c 20 37 2c 20 36 0,.. 9, 8, 7, 6
2210: 2c 20 35 2c 20 34 2c 20 33 2c 20 32 2c 20 30 2c , 5, 4, 3, 2, 0,
2220: 20 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 0};... vector
2230: 3c 69 6e 74 3e 20 62 6c 75 65 53 63 6f 72 65 28 <int> blueScore(
2240: 62 6c 75 65 53 63 6f 72 65 5f 2c 20 62 6c 75 65 blueScore_, blue
2250: 53 63 6f 72 65 5f 2b 73 69 7a 65 6f 66 28 62 6c Score_+sizeof(bl
2260: 75 65 53 63 6f 72 65 5f 29 2f 73 69 7a 65 6f 66 ueScore_)/sizeof
2270: 28 2a 62 6c 75 65 53 63 6f 72 65 5f 29 29 3b 20 (*blueScore_));
2280: 0d 0a 09 69 6e 74 20 5f 20 3d 20 33 30 30 3b 20 ...int _ = 300;
2290: 0d 0a 45 4e 44 0d 0a 2f 2a 0d 0a 43 41 53 45 28 ..END../*..CASE(
22a0: 35 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d 20 5)...int x_[] =
22b0: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e ;... vector <in
22c0: 74 3e 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 t> x(x_, x_+size
22d0: 6f 66 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 of(x_)/sizeof(*x
22e0: 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d _)); ...int y_[]
22f0: 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 = ;... vector
2300: 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f 2b 73 <int> y(y_, y_+s
2310: 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 6f 66 izeof(y_)/sizeof
2320: 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 72 (*y_)); ...int r
2330: 65 64 53 63 6f 72 65 5f 5b 5d 20 3d 20 3b 0d 0a edScore_[] = ;..
2340: 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 . vector <int>
2350: 72 65 64 53 63 6f 72 65 28 72 65 64 53 63 6f 72 redScore(redScor
2360: 65 5f 2c 20 72 65 64 53 63 6f 72 65 5f 2b 73 69 e_, redScore_+si
2370: 7a 65 6f 66 28 72 65 64 53 63 6f 72 65 5f 29 2f zeof(redScore_)/
2380: 73 69 7a 65 6f 66 28 2a 72 65 64 53 63 6f 72 65 sizeof(*redScore
2390: 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 62 6c 75 65 _)); ...int blue
23a0: 53 63 6f 72 65 5f 5b 5d 20 3d 20 3b 0d 0a 09 20 Score_[] = ;...
23b0: 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 62 6c vector <int> bl
23c0: 75 65 53 63 6f 72 65 28 62 6c 75 65 53 63 6f 72 ueScore(blueScor
23d0: 65 5f 2c 20 62 6c 75 65 53 63 6f 72 65 5f 2b 73 e_, blueScore_+s
23e0: 69 7a 65 6f 66 28 62 6c 75 65 53 63 6f 72 65 5f izeof(blueScore_
23f0: 29 2f 73 69 7a 65 6f 66 28 2a 62 6c 75 65 53 63 )/sizeof(*blueSc
2400: 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 5f ore_)); ...int _
2410: 20 3d 20 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 = ; ..END..CASE
2420: 28 36 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d (6)...int x_[] =
2430: 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 ;... vector <i
2440: 6e 74 3e 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a nt> x(x_, x_+siz
2450: 65 6f 66 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a eof(x_)/sizeof(*
2460: 78 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b x_)); ...int y_[
2470: 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 ] = ;... vector
2480: 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f 2b <int> y(y_, y_+
2490: 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 6f sizeof(y_)/sizeo
24a0: 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 f(*y_)); ...int
24b0: 72 65 64 53 63 6f 72 65 5f 5b 5d 20 3d 20 3b 0d redScore_[] = ;.
24c0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
24d0: 20 72 65 64 53 63 6f 72 65 28 72 65 64 53 63 6f redScore(redSco
24e0: 72 65 5f 2c 20 72 65 64 53 63 6f 72 65 5f 2b 73 re_, redScore_+s
24f0: 69 7a 65 6f 66 28 72 65 64 53 63 6f 72 65 5f 29 izeof(redScore_)
2500: 2f 73 69 7a 65 6f 66 28 2a 72 65 64 53 63 6f 72 /sizeof(*redScor
2510: 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 62 6c 75 e_)); ...int blu
2520: 65 53 63 6f 72 65 5f 5b 5d 20 3d 20 3b 0d 0a 09 eScore_[] = ;...
2530: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 62 vector <int> b
2540: 6c 75 65 53 63 6f 72 65 28 62 6c 75 65 53 63 6f lueScore(blueSco
2550: 72 65 5f 2c 20 62 6c 75 65 53 63 6f 72 65 5f 2b re_, blueScore_+
2560: 73 69 7a 65 6f 66 28 62 6c 75 65 53 63 6f 72 65 sizeof(blueScore
2570: 5f 29 2f 73 69 7a 65 6f 66 28 2a 62 6c 75 65 53 _)/sizeof(*blueS
2580: 63 6f 72 65 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 core_)); ...int
2590: 5f 20 3d 20 3b 20 0d 0a 45 4e 44 0d 0a 2a 2f 0d _ = ; ..END..*/.
25a0: 0a 7d 0d 0a 2f 2f 20 45 4e 44 20 43 55 54 20 48 .}..// END CUT H
25b0: 45 52 45 0d 0a ERE..