Hex Artifact Content
Not logged in

Artifact b9e1391bc29563f66375df1b9ebf879c060e83b4:


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 74 79 70 65 64 65 66 20 63 6f   LL;..typedef co
0180: 6d 70 6c 65 78 3c 64 6f 75 62 6c 65 3e 20 43 4d  mplex<double> CM
0190: 50 3b 0d 0a 73 74 61 74 69 63 20 63 6f 6e 73 74  P;..static const
01a0: 20 4c 4c 20 49 4e 46 20 3d 20 30 78 31 66 66 66   LL INF = 0x1fff
01b0: 66 66 66 66 66 66 66 66 66 66 66 66 4c 4c 3b 0d  ffffffffffffLL;.
01c0: 0a 0d 0a 63 6c 61 73 73 20 4e 65 67 61 74 69 76  ...class Negativ
01d0: 65 47 72 61 70 68 44 69 76 31 20 7b 20 70 75 62  eGraphDiv1 { pub
01e0: 6c 69 63 3a 0d 0a 09 6c 6f 6e 67 20 6c 6f 6e 67  lic:...long long
01f0: 20 66 69 6e 64 4d 69 6e 28 69 6e 74 20 4e 2c 20   findMin(int N, 
0200: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 66 72 6f  vector <int> fro
0210: 6d 2c 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20  m, vector <int> 
0220: 74 6f 2c 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e  to, vector <int>
0230: 20 77 65 69 67 68 74 2c 20 69 6e 74 20 63 68 61   weight, int cha
0240: 72 67 65 73 29 0d 0a 09 7b 0d 0a 09 09 2f 2f 20  rges)...{....// 
0250: 62 61 73 65 20 67 72 61 70 68 0d 0a 09 09 76 65  base graph....ve
0260: 63 74 6f 72 3c 76 65 63 74 6f 72 3c 4c 4c 3e 3e  ctor<vector<LL>>
0270: 20 67 28 4e 2c 20 76 65 63 74 6f 72 3c 4c 4c 3e   g(N, vector<LL>
0280: 28 4e 2c 20 49 4e 46 29 29 3b 0d 0a 09 09 76 65  (N, INF));....ve
0290: 63 74 6f 72 3c 76 65 63 74 6f 72 3c 4c 4c 3e 3e  ctor<vector<LL>>
02a0: 20 67 5f 6e 65 67 28 4e 2c 20 76 65 63 74 6f 72   g_neg(N, vector
02b0: 3c 4c 4c 3e 28 4e 2c 20 49 4e 46 29 29 3b 0d 0a  <LL>(N, INF));..
02c0: 09 09 66 6f 72 28 69 6e 74 20 69 3d 30 3b 20 69  ..for(int i=0; i
02d0: 3c 4e 3b 20 2b 2b 69 29 0d 0a 09 09 09 67 5b 69  <N; ++i).....g[i
02e0: 5d 5b 69 5d 20 3d 20 30 3b 0d 0a 09 09 66 6f 72  ][i] = 0;....for
02f0: 28 69 6e 74 20 69 3d 30 3b 20 69 3c 66 72 6f 6d  (int i=0; i<from
0300: 2e 73 69 7a 65 28 29 3b 20 2b 2b 69 29 20 7b 0d  .size(); ++i) {.
0310: 0a 09 09 09 69 6e 74 20 66 20 3d 20 66 72 6f 6d  ....int f = from
0320: 5b 69 5d 2d 31 3b 0d 0a 09 09 09 69 6e 74 20 74  [i]-1;.....int t
0330: 20 3d 20 74 6f 5b 69 5d 2d 31 3b 0d 0a 09 09 09   = to[i]-1;.....
0340: 4c 4c 20 20 77 20 3d 20 77 65 69 67 68 74 5b 69  LL  w = weight[i
0350: 5d 3b 0d 0a 09 09 09 67 5b 66 5d 5b 74 5d 20 3d  ];.....g[f][t] =
0360: 20 6d 69 6e 28 67 5b 66 5d 5b 74 5d 2c 20 77 29   min(g[f][t], w)
0370: 3b 0d 0a 09 09 09 67 5f 6e 65 67 5b 66 5d 5b 74  ;.....g_neg[f][t
0380: 5d 20 3d 20 6d 69 6e 28 67 5f 6e 65 67 5b 66 5d  ] = min(g_neg[f]
0390: 5b 74 5d 2c 20 2d 77 29 3b 0d 0a 09 09 7d 0d 0a  [t], -w);....}..
03a0: 0d 0a 09 09 69 6e 74 20 43 4d 41 58 20 3d 20 4e  ....int CMAX = N
03b0: 2a 32 3b 0d 0a 0d 0a 09 09 2f 2f 20 30 2d 6d 61  *2;......// 0-ma
03c0: 67 69 63 0d 0a 09 09 76 65 63 74 6f 72 3c 76 65  gic....vector<ve
03d0: 63 74 6f 72 3c 76 65 63 74 6f 72 3c 4c 4c 3e 3e  ctor<vector<LL>>
03e0: 3e 20 64 28 43 4d 41 58 2b 31 2c 20 67 29 3b 0d  > d(CMAX+1, g);.
03f0: 0a 09 09 66 6f 72 28 69 6e 74 20 6b 3d 30 3b 20  ...for(int k=0; 
0400: 6b 3c 4e 3b 20 2b 2b 6b 29 0d 0a 09 09 66 6f 72  k<N; ++k)....for
0410: 28 69 6e 74 20 69 3d 30 3b 20 69 3c 4e 3b 20 2b  (int i=0; i<N; +
0420: 2b 69 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 6a  +i)....for(int j
0430: 3d 30 3b 20 6a 3c 4e 3b 20 2b 2b 6a 29 0d 0a 09  =0; j<N; ++j)...
0440: 09 09 64 5b 30 5d 5b 69 5d 5b 6a 5d 20 3d 20 6d  ..d[0][i][j] = m
0450: 69 6e 28 64 5b 30 5d 5b 69 5d 5b 6a 5d 2c 20 64  in(d[0][i][j], d
0460: 5b 30 5d 5b 69 5d 5b 6b 5d 2b 64 5b 30 5d 5b 6b  [0][i][k]+d[0][k
0470: 5d 5b 6a 5d 29 3b 0d 0a 09 09 2f 2f 20 31 2d 6d  ][j]);....// 1-m
0480: 61 67 69 63 0d 0a 09 09 66 6f 72 28 69 6e 74 20  agic....for(int 
0490: 61 3d 30 3b 20 61 3c 4e 3b 20 2b 2b 61 29 0d 0a  a=0; a<N; ++a)..
04a0: 09 09 66 6f 72 28 69 6e 74 20 62 3d 30 3b 20 62  ..for(int b=0; b
04b0: 3c 4e 3b 20 2b 2b 62 29 0d 0a 09 09 66 6f 72 28  <N; ++b)....for(
04c0: 69 6e 74 20 63 3d 30 3b 20 63 3c 4e 3b 20 2b 2b  int c=0; c<N; ++
04d0: 63 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 7a 3d  c)....for(int z=
04e0: 30 3b 20 7a 3c 4e 3b 20 2b 2b 7a 29 0d 0a 09 09  0; z<N; ++z)....
04f0: 09 64 5b 31 5d 5b 61 5d 5b 7a 5d 20 3d 20 6d 69  .d[1][a][z] = mi
0500: 6e 28 64 5b 31 5d 5b 61 5d 5b 7a 5d 2c 20 64 5b  n(d[1][a][z], d[
0510: 30 5d 5b 61 5d 5b 62 5d 20 2b 20 67 5f 6e 65 67  0][a][b] + g_neg
0520: 5b 62 5d 5b 63 5d 20 2b 20 64 5b 30 5d 5b 63 5d  [b][c] + d[0][c]
0530: 5b 7a 5d 29 3b 0d 0a 0d 0a 09 09 2f 2f 20 43 2d  [z]);......// C-
0540: 6d 61 67 69 63 0d 0a 09 09 66 6f 72 28 69 6e 74  magic....for(int
0550: 20 43 3d 31 3b 20 43 3c 3d 43 4d 41 58 3b 20 2b   C=1; C<=CMAX; +
0560: 2b 43 29 20 7b 0d 0a 09 09 09 66 6f 72 28 69 6e  +C) {.....for(in
0570: 74 20 61 3d 30 3b 20 61 3c 4e 3b 20 2b 2b 61 29  t a=0; a<N; ++a)
0580: 0d 0a 09 09 09 66 6f 72 28 69 6e 74 20 62 3d 30  .....for(int b=0
0590: 3b 20 62 3c 4e 3b 20 2b 2b 62 29 0d 0a 09 09 09  ; b<N; ++b).....
05a0: 66 6f 72 28 69 6e 74 20 7a 3d 30 3b 20 7a 3c 4e  for(int z=0; z<N
05b0: 3b 20 2b 2b 7a 29 0d 0a 09 09 09 09 64 5b 43 5d  ; ++z)......d[C]
05c0: 5b 61 5d 5b 7a 5d 20 3d 20 6d 69 6e 28 64 5b 43  [a][z] = min(d[C
05d0: 5d 5b 61 5d 5b 7a 5d 2c 20 64 5b 31 5d 5b 61 5d  ][a][z], d[1][a]
05e0: 5b 62 5d 20 2b 20 64 5b 43 2d 31 5d 5b 62 5d 5b  [b] + d[C-1][b][
05f0: 7a 5d 29 3b 0d 0a 09 09 7d 0d 0a 0d 0a 09 09 2f  z]);....}....../
0600: 2f 20 67 6f 2c 63 79 63 6c 65 2c 67 6f 0d 0a 09  / go,cycle,go...
0610: 09 4c 4c 20 62 65 73 74 20 3d 20 49 4e 46 3b 0d  .LL best = INF;.
0620: 0a 09 09 66 6f 72 28 69 6e 74 20 53 3d 30 3b 20  ...for(int S=0; 
0630: 53 3c 3d 6d 69 6e 28 43 4d 41 58 2c 63 68 61 72  S<=min(CMAX,char
0640: 67 65 73 29 3b 20 2b 2b 53 29 0d 0a 09 09 09 62  ges); ++S).....b
0650: 65 73 74 20 3d 20 6d 69 6e 28 62 65 73 74 2c 20  est = min(best, 
0660: 64 5b 53 5d 5b 30 5d 5b 4e 2d 31 5d 29 3b 0d 0a  d[S][0][N-1]);..
0670: 09 09 66 6f 72 28 69 6e 74 20 53 3d 30 3b 20 53  ..for(int S=0; S
0680: 3c 3d 4e 3b 20 2b 2b 53 29 0d 0a 09 09 66 6f 72  <=N; ++S)....for
0690: 28 69 6e 74 20 4d 3d 31 3b 20 4d 3c 3d 4e 3b 20  (int M=1; M<=N; 
06a0: 2b 2b 4d 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20  ++M)....for(int 
06b0: 45 3d 30 3b 20 45 3c 3d 43 4d 41 58 3b 20 2b 2b  E=0; E<=CMAX; ++
06c0: 45 29 20 69 66 28 53 2b 45 3c 3d 63 68 61 72 67  E) if(S+E<=charg
06d0: 65 73 29 0d 0a 09 09 66 6f 72 28 69 6e 74 20 78  es)....for(int x
06e0: 3d 30 3b 20 78 3c 4e 3b 20 2b 2b 78 29 0d 0a 09  =0; x<N; ++x)...
06f0: 09 09 62 65 73 74 20 3d 20 6d 69 6e 28 62 65 73  ..best = min(bes
0700: 74 2c 20 64 5b 53 5d 5b 30 5d 5b 78 5d 20 2b 20  t, d[S][0][x] + 
0710: 64 5b 4d 5d 5b 78 5d 5b 78 5d 2a 28 28 63 68 61  d[M][x][x]*((cha
0720: 72 67 65 73 2d 53 2d 45 29 2f 4d 29 20 2b 20 64  rges-S-E)/M) + d
0730: 5b 45 5d 5b 78 5d 5b 4e 2d 31 5d 29 3b 0d 0a 09  [E][x][N-1]);...
0740: 09 72 65 74 75 72 6e 20 62 65 73 74 3b 0d 0a 09  .return best;...
0750: 7d 0d 0a 7d 3b 0d 0a 0d 0a 2f 2f 20 42 45 47 49  }..};....// BEGI
0760: 4e 20 43 55 54 20 48 45 52 45 0d 0a 23 69 6e 63  N CUT HERE..#inc
0770: 6c 75 64 65 20 3c 63 74 69 6d 65 3e 0d 0a 64 6f  lude <ctime>..do
0780: 75 62 6c 65 20 73 74 61 72 74 5f 74 69 6d 65 3b  uble start_time;
0790: 20 73 74 72 69 6e 67 20 74 69 6d 65 72 28 29 0d   string timer().
07a0: 0a 20 7b 20 6f 73 74 72 69 6e 67 73 74 72 65 61  . { ostringstrea
07b0: 6d 20 6f 73 3b 20 6f 73 20 3c 3c 20 22 20 28 22  m os; os << " ("
07c0: 20 3c 3c 20 69 6e 74 28 28 63 6c 6f 63 6b 28 29   << int((clock()
07d0: 2d 73 74 61 72 74 5f 74 69 6d 65 29 2f 43 4c 4f  -start_time)/CLO
07e0: 43 4b 53 5f 50 45 52 5f 53 45 43 2a 31 30 30 30  CKS_PER_SEC*1000
07f0: 29 20 3c 3c 20 22 20 6d 73 65 63 29 22 3b 20 72  ) << " msec)"; r
0800: 65 74 75 72 6e 20 6f 73 2e 73 74 72 28 29 3b 20  eturn os.str(); 
0810: 7d 0d 0a 74 65 6d 70 6c 61 74 65 3c 74 79 70 65  }..template<type
0820: 6e 61 6d 65 20 54 3e 20 6f 73 74 72 65 61 6d 26  name T> ostream&
0830: 20 6f 70 65 72 61 74 6f 72 3c 3c 28 6f 73 74 72   operator<<(ostr
0840: 65 61 6d 26 20 6f 73 2c 20 63 6f 6e 73 74 20 76  eam& os, const v
0850: 65 63 74 6f 72 3c 54 3e 26 20 76 29 0d 0a 20 7b  ector<T>& v).. {
0860: 20 6f 73 20 3c 3c 20 22 7b 20 22 3b 0d 0a 20 20   os << "{ ";..  
0870: 20 66 6f 72 28 74 79 70 65 6e 61 6d 65 20 76 65   for(typename ve
0880: 63 74 6f 72 3c 54 3e 3a 3a 63 6f 6e 73 74 5f 69  ctor<T>::const_i
0890: 74 65 72 61 74 6f 72 20 69 74 3d 76 2e 62 65 67  terator it=v.beg
08a0: 69 6e 28 29 3b 20 69 74 21 3d 76 2e 65 6e 64 28  in(); it!=v.end(
08b0: 29 3b 20 2b 2b 69 74 29 0d 0a 20 20 20 6f 73 20  ); ++it)..   os 
08c0: 3c 3c 20 27 5c 22 27 20 3c 3c 20 2a 69 74 20 3c  << '\"' << *it <
08d0: 3c 20 27 5c 22 27 20 3c 3c 20 28 69 74 2b 31 3d  < '\"' << (it+1=
08e0: 3d 76 2e 65 6e 64 28 29 20 3f 20 22 22 20 3a 20  =v.end() ? "" : 
08f0: 22 2c 20 22 29 3b 20 6f 73 20 3c 3c 20 22 20 7d  ", "); os << " }
0900: 22 3b 20 72 65 74 75 72 6e 20 6f 73 3b 20 7d 0d  "; return os; }.
0910: 0a 76 6f 69 64 20 76 65 72 69 66 79 5f 63 61 73  .void verify_cas
0920: 65 28 63 6f 6e 73 74 20 6c 6f 6e 67 20 6c 6f 6e  e(const long lon
0930: 67 26 20 45 78 70 65 63 74 65 64 2c 20 63 6f 6e  g& Expected, con
0940: 73 74 20 6c 6f 6e 67 20 6c 6f 6e 67 26 20 52 65  st long long& Re
0950: 63 65 69 76 65 64 29 20 7b 0d 0a 20 62 6f 6f 6c  ceived) {.. bool
0960: 20 6f 6b 20 3d 20 28 45 78 70 65 63 74 65 64 20   ok = (Expected 
0970: 3d 3d 20 52 65 63 65 69 76 65 64 29 3b 0d 0a 20  == Received);.. 
0980: 69 66 28 6f 6b 29 20 63 65 72 72 20 3c 3c 20 22  if(ok) cerr << "
0990: 50 41 53 53 45 44 22 20 3c 3c 20 74 69 6d 65 72  PASSED" << timer
09a0: 28 29 20 3c 3c 20 65 6e 64 6c 3b 20 20 65 6c 73  () << endl;  els
09b0: 65 20 7b 20 63 65 72 72 20 3c 3c 20 22 46 41 49  e { cerr << "FAI
09c0: 4c 45 44 22 20 3c 3c 20 74 69 6d 65 72 28 29 20  LED" << timer() 
09d0: 3c 3c 20 65 6e 64 6c 3b 0d 0a 20 63 65 72 72 20  << endl;.. cerr 
09e0: 3c 3c 20 22 5c 74 6f 3a 20 5c 22 22 20 3c 3c 20  << "\to: \"" << 
09f0: 45 78 70 65 63 74 65 64 20 3c 3c 20 27 5c 22 27  Expected << '\"'
0a00: 20 3c 3c 20 65 6e 64 6c 20 3c 3c 20 22 5c 74 78   << endl << "\tx
0a10: 3a 20 5c 22 22 20 3c 3c 20 52 65 63 65 69 76 65  : \"" << Receive
0a20: 64 20 3c 3c 20 27 5c 22 27 20 3c 3c 20 65 6e 64  d << '\"' << end
0a30: 6c 3b 20 7d 20 7d 0d 0a 23 64 65 66 69 6e 65 20  l; } }..#define 
0a40: 43 41 53 45 28 4e 29 20 7b 63 65 72 72 20 3c 3c  CASE(N) {cerr <<
0a50: 20 22 54 65 73 74 20 43 61 73 65 20 23 22 20 3c   "Test Case #" <
0a60: 3c 20 4e 20 3c 3c 20 22 2e 2e 2e 22 20 3c 3c 20  < N << "..." << 
0a70: 66 6c 75 73 68 3b 20 73 74 61 72 74 5f 74 69 6d  flush; start_tim
0a80: 65 3d 63 6c 6f 63 6b 28 29 3b 0d 0a 23 64 65 66  e=clock();..#def
0a90: 69 6e 65 20 45 4e 44 09 20 76 65 72 69 66 79 5f  ine END. verify_
0aa0: 63 61 73 65 28 5f 2c 20 4e 65 67 61 74 69 76 65  case(_, Negative
0ab0: 47 72 61 70 68 44 69 76 31 28 29 2e 66 69 6e 64  GraphDiv1().find
0ac0: 4d 69 6e 28 4e 2c 20 66 72 6f 6d 2c 20 74 6f 2c  Min(N, from, to,
0ad0: 20 77 65 69 67 68 74 2c 20 63 68 61 72 67 65 73   weight, charges
0ae0: 29 29 3b 7d 0d 0a 69 6e 74 20 6d 61 69 6e 28 29  ));}..int main()
0af0: 7b 0d 0a 0d 0a 43 41 53 45 28 30 29 0d 0a 09 69  {....CASE(0)...i
0b00: 6e 74 20 4e 20 3d 20 33 3b 20 0d 0a 09 69 6e 74  nt N = 3; ...int
0b10: 20 66 72 6f 6d 5f 5b 5d 20 3d 20 7b 31 2c 31 2c   from_[] = {1,1,
0b20: 32 2c 32 2c 33 2c 33 7d 3b 0d 0a 09 20 20 76 65  2,2,3,3};...  ve
0b30: 63 74 6f 72 20 3c 69 6e 74 3e 20 66 72 6f 6d 28  ctor <int> from(
0b40: 66 72 6f 6d 5f 2c 20 66 72 6f 6d 5f 2b 73 69 7a  from_, from_+siz
0b50: 65 6f 66 28 66 72 6f 6d 5f 29 2f 73 69 7a 65 6f  eof(from_)/sizeo
0b60: 66 28 2a 66 72 6f 6d 5f 29 29 3b 20 0d 0a 09 69  f(*from_)); ...i
0b70: 6e 74 20 74 6f 5f 5b 5d 20 3d 20 7b 32 2c 33 2c  nt to_[] = {2,3,
0b80: 31 2c 33 2c 31 2c 32 7d 3b 0d 0a 09 20 20 76 65  1,3,1,2};...  ve
0b90: 63 74 6f 72 20 3c 69 6e 74 3e 20 74 6f 28 74 6f  ctor <int> to(to
0ba0: 5f 2c 20 74 6f 5f 2b 73 69 7a 65 6f 66 28 74 6f  _, to_+sizeof(to
0bb0: 5f 29 2f 73 69 7a 65 6f 66 28 2a 74 6f 5f 29 29  _)/sizeof(*to_))
0bc0: 3b 20 0d 0a 09 69 6e 74 20 77 65 69 67 68 74 5f  ; ...int weight_
0bd0: 5b 5d 20 3d 20 7b 31 2c 35 2c 31 2c 31 30 2c 31  [] = {1,5,1,10,1
0be0: 2c 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20  ,1};...  vector 
0bf0: 3c 69 6e 74 3e 20 77 65 69 67 68 74 28 77 65 69  <int> weight(wei
0c00: 67 68 74 5f 2c 20 77 65 69 67 68 74 5f 2b 73 69  ght_, weight_+si
0c10: 7a 65 6f 66 28 77 65 69 67 68 74 5f 29 2f 73 69  zeof(weight_)/si
0c20: 7a 65 6f 66 28 2a 77 65 69 67 68 74 5f 29 29 3b  zeof(*weight_));
0c30: 20 0d 0a 09 69 6e 74 20 63 68 61 72 67 65 73 20   ...int charges 
0c40: 3d 20 31 3b 20 0d 0a 09 6c 6f 6e 67 20 6c 6f 6e  = 1; ...long lon
0c50: 67 20 5f 20 3d 20 2d 39 4c 4c 3b 20 0d 0a 45 4e  g _ = -9LL; ..EN
0c60: 44 0d 0a 43 41 53 45 28 31 29 0d 0a 09 69 6e 74  D..CASE(1)...int
0c70: 20 4e 20 3d 20 31 3b 20 0d 0a 09 69 6e 74 20 66   N = 1; ...int f
0c80: 72 6f 6d 5f 5b 5d 20 3d 20 7b 31 7d 3b 0d 0a 09  rom_[] = {1};...
0c90: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 66    vector <int> f
0ca0: 72 6f 6d 28 66 72 6f 6d 5f 2c 20 66 72 6f 6d 5f  rom(from_, from_
0cb0: 2b 73 69 7a 65 6f 66 28 66 72 6f 6d 5f 29 2f 73  +sizeof(from_)/s
0cc0: 69 7a 65 6f 66 28 2a 66 72 6f 6d 5f 29 29 3b 20  izeof(*from_)); 
0cd0: 0d 0a 09 69 6e 74 20 74 6f 5f 5b 5d 20 3d 20 7b  ...int to_[] = {
0ce0: 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  1};...  vector <
0cf0: 69 6e 74 3e 20 74 6f 28 74 6f 5f 2c 20 74 6f 5f  int> to(to_, to_
0d00: 2b 73 69 7a 65 6f 66 28 74 6f 5f 29 2f 73 69 7a  +sizeof(to_)/siz
0d10: 65 6f 66 28 2a 74 6f 5f 29 29 3b 20 0d 0a 09 69  eof(*to_)); ...i
0d20: 6e 74 20 77 65 69 67 68 74 5f 5b 5d 20 3d 20 7b  nt weight_[] = {
0d30: 31 30 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72  100};...  vector
0d40: 20 3c 69 6e 74 3e 20 77 65 69 67 68 74 28 77 65   <int> weight(we
0d50: 69 67 68 74 5f 2c 20 77 65 69 67 68 74 5f 2b 73  ight_, weight_+s
0d60: 69 7a 65 6f 66 28 77 65 69 67 68 74 5f 29 2f 73  izeof(weight_)/s
0d70: 69 7a 65 6f 66 28 2a 77 65 69 67 68 74 5f 29 29  izeof(*weight_))
0d80: 3b 20 0d 0a 09 69 6e 74 20 63 68 61 72 67 65 73  ; ...int charges
0d90: 20 3d 20 31 30 30 30 30 30 3b 20 0d 0a 09 6c 6f   = 100000; ...lo
0da0: 6e 67 20 6c 6f 6e 67 20 5f 20 3d 20 2d 31 30 30  ng long _ = -100
0db0: 30 30 30 30 30 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a  00000LL; ..END..
0dc0: 43 41 53 45 28 32 29 0d 0a 09 69 6e 74 20 4e 20  CASE(2)...int N 
0dd0: 3d 20 32 3b 20 0d 0a 09 69 6e 74 20 66 72 6f 6d  = 2; ...int from
0de0: 5f 5b 5d 20 3d 20 7b 31 2c 31 2c 32 7d 3b 0d 0a  _[] = {1,1,2};..
0df0: 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20  .  vector <int> 
0e00: 66 72 6f 6d 28 66 72 6f 6d 5f 2c 20 66 72 6f 6d  from(from_, from
0e10: 5f 2b 73 69 7a 65 6f 66 28 66 72 6f 6d 5f 29 2f  _+sizeof(from_)/
0e20: 73 69 7a 65 6f 66 28 2a 66 72 6f 6d 5f 29 29 3b  sizeof(*from_));
0e30: 20 0d 0a 09 69 6e 74 20 74 6f 5f 5b 5d 20 3d 20   ...int to_[] = 
0e40: 7b 32 2c 32 2c 31 7d 3b 0d 0a 09 20 20 76 65 63  {2,2,1};...  vec
0e50: 74 6f 72 20 3c 69 6e 74 3e 20 74 6f 28 74 6f 5f  tor <int> to(to_
0e60: 2c 20 74 6f 5f 2b 73 69 7a 65 6f 66 28 74 6f 5f  , to_+sizeof(to_
0e70: 29 2f 73 69 7a 65 6f 66 28 2a 74 6f 5f 29 29 3b  )/sizeof(*to_));
0e80: 20 0d 0a 09 69 6e 74 20 77 65 69 67 68 74 5f 5b   ...int weight_[
0e90: 5d 20 3d 20 7b 36 2c 31 2c 34 7d 3b 0d 0a 09 20  ] = {6,1,4};... 
0ea0: 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 77 65   vector <int> we
0eb0: 69 67 68 74 28 77 65 69 67 68 74 5f 2c 20 77 65  ight(weight_, we
0ec0: 69 67 68 74 5f 2b 73 69 7a 65 6f 66 28 77 65 69  ight_+sizeof(wei
0ed0: 67 68 74 5f 29 2f 73 69 7a 65 6f 66 28 2a 77 65  ght_)/sizeof(*we
0ee0: 69 67 68 74 5f 29 29 3b 20 0d 0a 09 69 6e 74 20  ight_)); ...int 
0ef0: 63 68 61 72 67 65 73 20 3d 20 32 3b 20 0d 0a 09  charges = 2; ...
0f00: 6c 6f 6e 67 20 6c 6f 6e 67 20 5f 20 3d 20 2d 39  long long _ = -9
0f10: 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28  LL; ..END..CASE(
0f20: 33 29 0d 0a 09 69 6e 74 20 4e 20 3d 20 32 3b 20  3)...int N = 2; 
0f30: 0d 0a 09 69 6e 74 20 66 72 6f 6d 5f 5b 5d 20 3d  ...int from_[] =
0f40: 20 7b 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72   {1};...  vector
0f50: 20 3c 69 6e 74 3e 20 66 72 6f 6d 28 66 72 6f 6d   <int> from(from
0f60: 5f 2c 20 66 72 6f 6d 5f 2b 73 69 7a 65 6f 66 28  _, from_+sizeof(
0f70: 66 72 6f 6d 5f 29 2f 73 69 7a 65 6f 66 28 2a 66  from_)/sizeof(*f
0f80: 72 6f 6d 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 74  rom_)); ...int t
0f90: 6f 5f 5b 5d 20 3d 20 7b 32 7d 3b 0d 0a 09 20 20  o_[] = {2};...  
0fa0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 74 6f 28  vector <int> to(
0fb0: 74 6f 5f 2c 20 74 6f 5f 2b 73 69 7a 65 6f 66 28  to_, to_+sizeof(
0fc0: 74 6f 5f 29 2f 73 69 7a 65 6f 66 28 2a 74 6f 5f  to_)/sizeof(*to_
0fd0: 29 29 3b 20 0d 0a 09 69 6e 74 20 77 65 69 67 68  )); ...int weigh
0fe0: 74 5f 5b 5d 20 3d 20 7b 39 38 37 36 35 7d 3b 0d  t_[] = {98765};.
0ff0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e  ..  vector <int>
1000: 20 77 65 69 67 68 74 28 77 65 69 67 68 74 5f 2c   weight(weight_,
1010: 20 77 65 69 67 68 74 5f 2b 73 69 7a 65 6f 66 28   weight_+sizeof(
1020: 77 65 69 67 68 74 5f 29 2f 73 69 7a 65 6f 66 28  weight_)/sizeof(
1030: 2a 77 65 69 67 68 74 5f 29 29 3b 20 0d 0a 09 69  *weight_)); ...i
1040: 6e 74 20 63 68 61 72 67 65 73 20 3d 20 31 30 30  nt charges = 100
1050: 30 30 30 30 30 30 30 3b 20 0d 0a 09 6c 6f 6e 67  0000000; ...long
1060: 20 6c 6f 6e 67 20 5f 20 3d 20 2d 39 38 37 36 35   long _ = -98765
1070: 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28  LL; ..END..CASE(
1080: 34 29 0d 0a 09 69 6e 74 20 4e 20 3d 20 34 30 3b  4)...int N = 40;
1090: 20 0d 0a 09 69 6e 74 20 66 72 6f 6d 5f 5b 5d 20   ...int from_[] 
10a0: 3d 20 7b 32 31 2c 32 2c 33 36 2c 32 31 2c 33 32  = {21,2,36,21,32
10b0: 2c 31 2c 33 34 2c 31 2c 34 30 2c 33 38 2c 31 39  ,1,34,1,40,38,19
10c0: 2c 31 30 2c 33 39 2c 34 30 2c 33 31 2c 32 39 2c  ,10,39,40,31,29,
10d0: 32 32 2c 31 38 2c 32 34 2c 38 2c 32 35 2c 31 2c  22,18,24,8,25,1,
10e0: 31 32 2c 33 31 2c 31 2c 33 34 2c 31 36 2c 31 33  12,31,1,34,16,13
10f0: 2c 33 39 2c 33 39 2c 32 36 2c 33 30 2c 34 2c 32  ,39,39,26,30,4,2
1100: 38 2c 38 2c 39 2c 32 37 2c 31 33 2c 36 2c 31 36  8,8,9,27,13,6,16
1110: 2c 37 2c 31 31 2c 37 2c 33 38 2c 33 30 2c 32 30  ,7,11,7,38,30,20
1120: 2c 32 32 2c 32 39 2c 31 39 2c 35 2c 32 32 2c 31  ,22,29,19,5,22,1
1130: 33 2c 31 32 2c 37 2c 0d 0a 33 33 2c 35 2c 31 30  3,12,7,..33,5,10
1140: 2c 33 31 2c 31 30 2c 33 39 2c 31 38 2c 31 38 2c  ,31,10,39,18,18,
1150: 33 2c 31 39 2c 31 37 2c 31 37 2c 33 34 2c 39 2c  3,19,17,17,34,9,
1160: 37 2c 31 37 2c 32 31 2c 31 33 2c 31 32 2c 31 36  7,17,21,13,12,16
1170: 2c 33 36 2c 33 39 2c 39 2c 37 2c 33 2c 35 2c 32  ,36,39,9,7,3,5,2
1180: 36 2c 31 36 2c 33 32 2c 34 2c 32 36 2c 31 32 2c  6,16,32,4,26,12,
1190: 32 37 2c 32 34 2c 31 39 2c 31 2c 31 39 2c 31 37  27,24,19,1,19,17
11a0: 2c 39 2c 32 32 2c 31 36 2c 31 32 2c 33 31 2c 33  ,9,22,16,12,31,3
11b0: 37 2c 33 32 2c 39 2c 33 31 2c 38 2c 32 2c 33 39  7,32,9,31,8,2,39
11c0: 2c 31 38 2c 32 36 2c 33 32 2c 31 32 2c 0d 0a 32  ,18,26,32,12,..2
11d0: 38 2c 31 31 2c 33 32 2c 33 34 2c 32 2c 31 32 2c  8,11,32,34,2,12,
11e0: 31 32 2c 33 33 2c 32 37 2c 32 34 2c 35 2c 35 2c  12,33,27,24,5,5,
11f0: 34 30 2c 33 34 2c 34 2c 38 2c 31 30 2c 31 37 2c  40,34,4,8,10,17,
1200: 33 39 2c 33 30 2c 32 36 2c 32 34 2c 31 30 2c 33  39,30,26,24,10,3
1210: 37 2c 32 33 2c 34 30 2c 33 38 2c 31 37 2c 34 2c  7,23,40,38,17,4,
1220: 32 38 2c 33 33 2c 33 31 2c 32 38 2c 31 39 2c 33  28,33,31,28,19,3
1230: 36 2c 35 2c 32 34 2c 31 37 2c 31 31 2c 31 39 2c  6,5,24,17,11,19,
1240: 34 2c 34 30 2c 32 30 2c 31 36 2c 31 31 2c 31 30  4,40,20,16,11,10
1250: 2c 39 2c 32 32 2c 32 33 2c 32 33 2c 38 2c 33 30  ,9,22,23,23,8,30
1260: 2c 31 30 2c 0d 0a 32 33 2c 31 36 2c 32 31 2c 31  ,10,..23,16,21,1
1270: 30 2c 31 38 2c 38 2c 32 38 2c 31 35 2c 32 30 2c  0,18,8,28,15,20,
1280: 33 38 2c 35 2c 32 32 2c 34 2c 32 39 2c 33 32 2c  38,5,22,4,29,32,
1290: 31 33 2c 31 33 2c 31 35 2c 32 34 2c 32 38 2c 32  13,13,15,24,28,2
12a0: 37 2c 31 31 2c 32 34 2c 32 34 2c 32 33 2c 34 30  7,11,24,24,23,40
12b0: 2c 33 34 2c 32 30 2c 32 38 2c 31 38 2c 32 36 2c  ,34,20,28,18,26,
12c0: 33 34 2c 32 31 2c 31 33 2c 31 31 2c 33 33 2c 32  34,21,13,11,33,2
12d0: 38 2c 38 2c 35 2c 39 2c 33 31 2c 31 2c 33 32 2c  8,8,5,9,31,1,32,
12e0: 37 2c 32 32 2c 31 32 2c 38 2c 31 32 2c 38 2c 31  7,22,12,8,12,8,1
12f0: 32 2c 33 31 2c 33 35 2c 33 33 2c 0d 0a 32 37 2c  2,31,35,33,..27,
1300: 31 38 2c 36 2c 32 32 2c 33 38 2c 39 2c 34 30 2c  18,6,22,38,9,40,
1310: 33 35 2c 31 35 2c 31 36 2c 33 30 2c 34 2c 33 2c  35,15,16,30,4,3,
1320: 32 39 2c 32 2c 33 34 2c 34 30 2c 33 2c 31 32 2c  29,2,34,40,3,12,
1330: 32 30 2c 32 39 2c 31 34 2c 32 2c 33 2c 38 2c 33  20,29,14,2,3,8,3
1340: 37 2c 31 32 2c 32 38 2c 32 35 2c 37 2c 32 32 2c  7,12,28,25,7,22,
1350: 33 33 2c 34 2c 31 35 2c 35 2c 31 34 2c 32 36 2c  33,4,15,5,14,26,
1360: 32 32 2c 31 36 2c 33 33 2c 31 32 2c 31 31 2c 31  22,16,33,12,11,1
1370: 34 2c 31 31 2c 35 2c 32 35 2c 33 30 2c 32 31 2c  4,11,5,25,30,21,
1380: 32 30 2c 33 30 2c 32 35 2c 33 30 2c 32 38 2c 33  20,30,25,30,28,3
1390: 37 2c 0d 0a 32 33 2c 33 31 2c 33 30 2c 33 2c 31  7,..23,31,30,3,1
13a0: 35 2c 35 2c 32 35 2c 31 34 2c 38 2c 31 33 2c 31  5,5,25,14,8,13,1
13b0: 32 2c 34 2c 31 38 2c 39 2c 32 30 2c 31 37 2c 31  2,4,18,9,20,17,1
13c0: 31 2c 32 31 2c 35 2c 32 35 2c 31 35 2c 39 2c 34  1,21,5,25,15,9,4
13d0: 30 2c 32 36 2c 32 38 2c 33 36 2c 31 2c 31 30 2c  0,26,28,36,1,10,
13e0: 33 33 2c 33 34 2c 35 2c 33 2c 32 31 2c 33 32 2c  33,34,5,3,21,32,
13f0: 31 35 2c 33 30 2c 33 33 2c 33 32 2c 33 31 2c 31  15,30,33,32,31,1
1400: 39 2c 31 32 2c 32 2c 31 36 2c 31 33 2c 31 35 2c  9,12,2,16,13,15,
1410: 34 2c 33 33 2c 33 33 2c 32 36 2c 36 2c 37 2c 33  4,33,33,26,6,7,3
1420: 36 2c 32 30 2c 31 34 2c 37 2c 0d 0a 33 39 2c 31  6,20,14,7,..39,1
1430: 37 2c 33 33 2c 34 2c 35 2c 32 32 2c 32 31 2c 31  7,33,4,5,22,21,1
1440: 33 2c 32 39 2c 33 38 2c 33 34 2c 36 2c 32 34 2c  3,29,38,34,6,24,
1450: 31 38 2c 32 39 2c 34 2c 32 30 2c 33 33 2c 31 36  18,29,4,20,33,16
1460: 2c 31 34 2c 33 30 2c 32 30 2c 32 30 2c 37 2c 32  ,14,30,20,20,7,2
1470: 31 2c 31 33 2c 35 2c 32 30 2c 31 2c 38 2c 31 38  1,13,5,20,1,8,18
1480: 2c 39 2c 31 32 2c 32 34 2c 31 30 2c 32 32 2c 33  ,9,12,24,10,22,3
1490: 33 2c 34 30 2c 32 38 2c 33 30 2c 32 33 2c 37 2c  3,40,28,30,23,7,
14a0: 33 36 2c 32 37 2c 33 38 2c 33 36 2c 31 35 2c 33  36,27,38,36,15,3
14b0: 2c 33 36 2c 38 2c 32 30 2c 32 37 2c 31 32 2c 35  ,36,8,20,27,12,5
14c0: 2c 0d 0a 33 33 2c 34 30 2c 37 2c 32 35 2c 32 30  ,..33,40,7,25,20
14d0: 2c 31 33 2c 33 36 2c 33 30 2c 31 33 2c 39 2c 33  ,13,36,30,13,9,3
14e0: 2c 31 35 2c 33 38 2c 33 33 2c 32 37 2c 33 36 2c  ,15,38,33,27,36,
14f0: 34 2c 39 2c 31 38 2c 33 39 2c 37 2c 31 32 2c 33  4,9,18,39,7,12,3
1500: 30 2c 31 37 2c 32 2c 32 31 2c 31 37 2c 31 31 2c  0,17,2,21,17,11,
1510: 32 36 2c 31 34 2c 32 39 2c 32 36 2c 33 31 2c 31  26,14,29,26,31,1
1520: 35 2c 31 33 2c 31 32 2c 31 39 2c 33 35 2c 31 31  5,13,12,19,35,11
1530: 2c 32 35 2c 31 39 2c 31 35 2c 33 34 2c 39 2c 31  ,25,19,15,34,9,1
1540: 32 2c 31 37 2c 33 37 2c 32 32 2c 32 32 2c 31 36  2,17,37,22,22,16
1550: 2c 31 30 2c 31 33 2c 0d 0a 31 37 2c 31 32 2c 31  ,10,13,..17,12,1
1560: 32 2c 33 32 2c 31 2c 34 30 2c 31 30 2c 33 34 2c  2,32,1,40,10,34,
1570: 32 39 2c 33 39 2c 37 2c 31 37 2c 33 7d 3b 0d 0a  29,39,7,17,3};..
1580: 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20  .  vector <int> 
1590: 66 72 6f 6d 28 66 72 6f 6d 5f 2c 20 66 72 6f 6d  from(from_, from
15a0: 5f 2b 73 69 7a 65 6f 66 28 66 72 6f 6d 5f 29 2f  _+sizeof(from_)/
15b0: 73 69 7a 65 6f 66 28 2a 66 72 6f 6d 5f 29 29 3b  sizeof(*from_));
15c0: 20 0d 0a 09 69 6e 74 20 74 6f 5f 5b 5d 20 3d 20   ...int to_[] = 
15d0: 7b 32 37 2c 33 37 2c 33 32 2c 31 34 2c 31 39 2c  {27,37,32,14,19,
15e0: 32 35 2c 34 2c 31 34 2c 34 30 2c 39 2c 33 36 2c  25,4,14,40,9,36,
15f0: 32 33 2c 32 31 2c 32 35 2c 33 39 2c 31 33 2c 34  23,21,25,39,13,4
1600: 2c 33 30 2c 31 31 2c 33 32 2c 32 32 2c 31 32 2c  ,30,11,32,22,12,
1610: 32 39 2c 34 30 2c 33 35 2c 33 32 2c 34 2c 31 35  29,40,35,32,4,15
1620: 2c 32 35 2c 38 2c 31 37 2c 31 38 2c 31 37 2c 31  ,25,8,17,18,17,1
1630: 39 2c 33 34 2c 31 2c 31 36 2c 31 36 2c 32 36 2c  9,34,1,16,16,26,
1640: 32 38 2c 32 2c 32 38 2c 32 31 2c 31 36 2c 36 2c  28,2,28,21,16,6,
1650: 33 2c 31 32 2c 33 39 2c 32 34 2c 33 31 2c 33 2c  3,12,39,24,31,3,
1660: 32 35 2c 32 36 2c 0d 0a 33 30 2c 39 2c 33 35 2c  25,26,..30,9,35,
1670: 32 39 2c 32 30 2c 34 2c 32 31 2c 32 35 2c 31 35  29,20,4,21,25,15
1680: 2c 33 32 2c 32 37 2c 32 34 2c 31 33 2c 33 2c 31  ,32,27,24,13,3,1
1690: 30 2c 32 31 2c 34 30 2c 31 32 2c 33 39 2c 34 2c  0,21,40,12,39,4,
16a0: 31 30 2c 32 2c 33 39 2c 32 38 2c 32 33 2c 32 31  10,2,39,28,23,21
16b0: 2c 31 39 2c 32 31 2c 31 31 2c 33 32 2c 32 30 2c  ,19,21,11,32,20,
16c0: 33 36 2c 37 2c 31 31 2c 32 31 2c 31 36 2c 32 39  36,7,11,21,16,29
16d0: 2c 31 37 2c 32 34 2c 31 38 2c 33 32 2c 31 37 2c  ,17,24,18,32,17,
16e0: 33 38 2c 32 33 2c 33 35 2c 31 2c 31 39 2c 32 38  38,23,35,1,19,28
16f0: 2c 32 30 2c 33 31 2c 33 37 2c 31 36 2c 0d 0a 32  ,20,31,37,16,..2
1700: 30 2c 37 2c 33 31 2c 33 2c 37 2c 33 36 2c 31 35  0,7,31,3,7,36,15
1710: 2c 33 36 2c 31 30 2c 36 2c 33 37 2c 32 36 2c 33  ,36,10,6,37,26,3
1720: 39 2c 33 39 2c 32 36 2c 33 31 2c 38 2c 33 36 2c  9,39,26,31,8,36,
1730: 32 36 2c 31 30 2c 32 31 2c 32 34 2c 33 33 2c 31  26,10,21,24,33,1
1740: 33 2c 32 39 2c 33 31 2c 31 30 2c 31 32 2c 32 30  3,29,31,10,12,20
1750: 2c 33 31 2c 33 39 2c 33 35 2c 32 39 2c 33 39 2c  ,31,39,35,29,39,
1760: 33 30 2c 33 34 2c 32 36 2c 31 35 2c 33 30 2c 34  30,34,26,15,30,4
1770: 2c 33 36 2c 31 36 2c 33 38 2c 32 2c 33 31 2c 32  ,36,16,38,2,31,2
1780: 32 2c 31 38 2c 31 37 2c 31 32 2c 32 31 2c 34 2c  2,18,17,12,21,4,
1790: 31 31 2c 0d 0a 33 32 2c 33 2c 32 37 2c 31 34 2c  11,..32,3,27,14,
17a0: 32 32 2c 31 36 2c 33 37 2c 34 30 2c 31 38 2c 32  22,16,37,40,18,2
17b0: 35 2c 32 38 2c 32 30 2c 32 37 2c 32 37 2c 33 30  5,28,20,27,27,30
17c0: 2c 31 31 2c 31 39 2c 31 36 2c 31 38 2c 32 35 2c  ,11,19,16,18,25,
17d0: 34 2c 32 31 2c 31 34 2c 31 34 2c 31 33 2c 32 32  4,21,14,14,13,22
17e0: 2c 33 34 2c 32 35 2c 39 2c 33 31 2c 32 37 2c 31  ,34,25,9,31,27,1
17f0: 34 2c 33 32 2c 32 33 2c 32 31 2c 33 2c 31 2c 32  4,32,23,21,3,1,2
1800: 34 2c 31 35 2c 33 30 2c 33 35 2c 31 2c 32 34 2c  4,15,30,35,1,24,
1810: 33 37 2c 37 2c 32 38 2c 38 2c 32 31 2c 34 30 2c  37,7,28,8,21,40,
1820: 36 2c 32 39 2c 33 36 2c 33 37 2c 0d 0a 32 31 2c  6,29,36,37,..21,
1830: 38 2c 31 37 2c 32 30 2c 32 30 2c 32 38 2c 32 32  8,17,20,20,28,22
1840: 2c 32 32 2c 31 33 2c 32 39 2c 33 34 2c 32 30 2c  ,22,13,29,34,20,
1850: 32 36 2c 31 31 2c 31 30 2c 38 2c 33 33 2c 31 30  26,11,10,8,33,10
1860: 2c 33 37 2c 31 31 2c 31 36 2c 35 2c 39 2c 31 38  ,37,11,16,5,9,18
1870: 2c 33 39 2c 31 2c 38 2c 34 2c 35 2c 32 2c 32 30  ,39,1,8,4,5,2,20
1880: 2c 33 30 2c 34 2c 32 33 2c 33 30 2c 32 33 2c 31  ,30,4,23,30,23,1
1890: 39 2c 32 35 2c 33 30 2c 33 37 2c 34 30 2c 33 31  9,25,30,37,40,31
18a0: 2c 33 31 2c 33 33 2c 33 33 2c 38 2c 33 36 2c 34  ,31,33,33,8,36,4
18b0: 30 2c 31 35 2c 31 31 2c 33 31 2c 33 37 2c 35 2c  0,15,11,31,37,5,
18c0: 34 30 2c 0d 0a 32 2c 31 31 2c 31 39 2c 33 32 2c  40,..2,11,19,32,
18d0: 31 2c 33 32 2c 32 37 2c 37 2c 32 33 2c 39 2c 31  1,32,27,7,23,9,1
18e0: 33 2c 31 38 2c 31 32 2c 33 36 2c 31 31 2c 33 32  3,18,12,36,11,32
18f0: 2c 33 34 2c 33 38 2c 33 35 2c 31 35 2c 36 2c 33  ,34,38,35,15,6,3
1900: 36 2c 33 32 2c 32 38 2c 36 2c 34 30 2c 32 2c 33  6,32,28,6,40,2,3
1910: 33 2c 32 2c 36 2c 37 2c 32 37 2c 34 30 2c 33 30  3,2,6,7,27,40,30
1920: 2c 34 30 2c 31 32 2c 33 39 2c 31 33 2c 31 2c 32  ,40,12,39,13,1,2
1930: 32 2c 31 37 2c 33 36 2c 31 2c 34 2c 33 34 2c 32  2,17,36,1,4,34,2
1940: 35 2c 32 35 2c 36 2c 32 30 2c 32 35 2c 33 30 2c  5,25,6,20,25,30,
1950: 34 2c 32 34 2c 33 35 2c 37 2c 35 2c 0d 0a 32 39  4,24,35,7,5,..29
1960: 2c 32 30 2c 32 38 2c 33 37 2c 31 2c 33 30 2c 36  ,20,28,37,1,30,6
1970: 2c 35 2c 35 2c 31 2c 31 30 2c 34 30 2c 31 33 2c  ,5,5,1,10,40,13,
1980: 31 34 2c 32 31 2c 33 32 2c 31 39 2c 32 35 2c 33  14,21,32,19,25,3
1990: 37 2c 32 31 2c 32 38 2c 33 34 2c 32 38 2c 32 39  7,21,28,34,28,29
19a0: 2c 32 37 2c 32 34 2c 33 33 2c 33 35 2c 31 32 2c  ,27,24,33,35,12,
19b0: 32 35 2c 33 2c 34 2c 31 32 2c 33 31 2c 31 32 2c  25,3,4,12,31,12,
19c0: 37 2c 32 38 2c 32 37 2c 31 30 2c 33 35 2c 33 35  7,28,27,10,35,35
19d0: 2c 31 38 2c 36 2c 35 2c 31 36 2c 32 34 2c 33 39  ,18,6,5,16,24,39
19e0: 2c 32 36 2c 31 35 2c 32 39 2c 31 33 2c 35 2c 31  ,26,15,29,13,5,1
19f0: 34 2c 33 36 2c 0d 0a 33 35 2c 31 34 2c 32 2c 33  4,36,..35,14,2,3
1a00: 39 2c 32 32 2c 32 31 2c 32 2c 32 2c 31 39 2c 33  9,22,21,2,2,19,3
1a10: 38 2c 31 35 2c 32 35 2c 31 30 2c 31 33 2c 32 2c  8,15,25,10,13,2,
1a20: 33 39 2c 33 31 2c 31 33 2c 35 2c 33 39 2c 31 31  39,31,13,5,39,11
1a30: 2c 33 33 2c 34 2c 31 38 2c 31 38 2c 33 38 2c 31  ,33,4,18,18,38,1
1a40: 39 2c 33 39 2c 33 39 2c 33 32 2c 32 33 2c 33 34  9,39,39,32,23,34
1a50: 2c 33 30 2c 32 31 2c 33 30 2c 31 36 2c 33 36 2c  ,30,21,30,16,36,
1a60: 32 32 2c 32 35 2c 31 34 2c 31 33 2c 31 36 2c 31  22,25,14,13,16,1
1a70: 30 2c 38 2c 32 37 2c 32 39 2c 34 30 2c 31 2c 32  0,8,27,29,40,1,2
1a80: 39 2c 34 2c 32 30 2c 32 35 2c 33 32 2c 0d 0a 32  9,4,20,25,32,..2
1a90: 31 2c 34 30 2c 31 2c 31 30 2c 32 2c 31 37 2c 35  1,40,1,10,2,17,5
1aa0: 2c 38 2c 35 2c 33 31 2c 31 38 2c 31 38 2c 32 35  ,8,5,31,18,18,25
1ab0: 2c 31 33 2c 33 7d 3b 0d 0a 09 20 20 76 65 63 74  ,13,3};...  vect
1ac0: 6f 72 20 3c 69 6e 74 3e 20 74 6f 28 74 6f 5f 2c  or <int> to(to_,
1ad0: 20 74 6f 5f 2b 73 69 7a 65 6f 66 28 74 6f 5f 29   to_+sizeof(to_)
1ae0: 2f 73 69 7a 65 6f 66 28 2a 74 6f 5f 29 29 3b 20  /sizeof(*to_)); 
1af0: 0d 0a 09 69 6e 74 20 77 65 69 67 68 74 5f 5b 5d  ...int weight_[]
1b00: 20 3d 20 7b 39 33 34 38 36 2c 35 35 35 33 39 2c   = {93486,55539,
1b10: 33 34 36 38 30 2c 35 36 37 30 35 2c 31 30 34 31  34680,56705,1041
1b20: 35 2c 39 39 31 30 36 2c 32 36 33 36 35 2c 35 31  5,99106,26365,51
1b30: 38 33 38 2c 32 30 37 39 34 2c 39 33 31 37 38 2c  838,20794,93178,
1b40: 33 33 39 34 33 2c 38 30 32 36 30 2c 36 30 37 38  33943,80260,6078
1b50: 30 2c 32 34 30 35 2c 37 38 33 34 36 2c 37 31 39  0,2405,78346,719
1b60: 32 39 2c 32 34 37 32 33 2c 33 37 36 31 34 2c 36  29,24723,37614,6
1b70: 32 36 34 39 2c 38 33 34 38 36 2c 33 32 30 37 33  2649,83486,32073
1b80: 2c 38 33 38 36 36 2c 38 38 33 34 35 2c 38 33 32  ,83866,88345,832
1b90: 31 33 2c 32 38 32 36 36 2c 0d 0a 31 32 37 33 30  13,28266,..12730
1ba0: 2c 32 37 36 32 33 2c 32 35 33 35 33 2c 38 39 39  ,27623,25353,899
1bb0: 34 38 2c 35 35 30 30 32 2c 33 36 37 32 30 2c 38  48,55002,36720,8
1bc0: 37 31 35 31 2c 33 39 37 35 39 2c 36 36 30 39 31  7151,39759,66091
1bd0: 2c 33 36 39 30 2c 38 33 38 38 31 2c 38 32 36 33  ,3690,83881,8263
1be0: 35 2c 36 39 30 38 34 2c 35 34 31 33 38 2c 36 35  5,69084,54138,65
1bf0: 38 37 36 2c 35 34 32 30 35 2c 31 30 32 33 36 2c  876,54205,10236,
1c00: 39 30 34 37 38 2c 33 37 32 33 30 2c 32 32 33 33  90478,37230,2233
1c10: 37 2c 38 32 30 39 2c 31 34 32 35 38 2c 31 38 33  7,8209,14258,183
1c20: 37 35 2c 35 32 36 38 2c 32 31 38 32 34 2c 0d 0a  75,5268,21824,..
1c30: 37 36 38 31 39 2c 34 30 39 34 2c 36 33 39 37 31  76819,4094,63971
1c40: 2c 31 34 35 34 2c 32 31 33 31 38 2c 34 34 38 34  ,1454,21318,4484
1c50: 38 2c 39 32 35 34 30 2c 32 36 33 35 34 2c 31 38  8,92540,26354,18
1c60: 36 31 31 2c 32 33 39 34 2c 36 38 33 36 33 2c 36  611,2394,68363,6
1c70: 34 33 34 35 2c 36 30 39 38 35 2c 37 32 35 2c 33  4345,60985,725,3
1c80: 33 36 39 32 2c 32 31 31 39 35 2c 36 30 39 39 32  3692,21195,60992
1c90: 2c 31 30 32 34 33 2c 36 32 30 30 36 2c 37 34 38  ,10243,62006,748
1ca0: 38 34 2c 37 38 32 32 2c 36 36 38 33 30 2c 31 36  84,7822,66830,16
1cb0: 31 31 34 2c 31 34 36 36 33 2c 36 30 37 30 31 2c  114,14663,60701,
1cc0: 33 38 31 37 34 2c 0d 0a 33 30 34 39 33 2c 32 36  38174,..30493,26
1cd0: 33 36 30 2c 37 37 34 35 2c 37 31 36 35 2c 34 37  360,7745,7165,47
1ce0: 36 36 38 2c 38 33 38 38 34 2c 38 39 34 36 33 2c  668,83884,89463,
1cf0: 34 36 36 31 35 2c 37 37 32 39 2c 32 32 31 38 37  46615,7729,22187
1d00: 2c 37 38 38 31 38 2c 31 30 38 31 37 2c 33 31 31  ,78818,10817,311
1d10: 34 31 2c 37 39 31 35 39 2c 32 34 32 38 30 2c 36  41,79159,24280,6
1d20: 37 35 38 35 2c 34 38 30 33 39 2c 33 30 30 30 2c  7585,48039,3000,
1d30: 39 38 37 34 33 2c 33 39 34 35 35 2c 31 32 30 33  98743,39455,1203
1d40: 30 2c 32 37 35 39 35 2c 35 35 34 37 30 2c 31 34  0,27595,55470,14
1d50: 36 31 37 2c 39 33 32 37 35 2c 0d 0a 32 31 32 33  617,93275,..2123
1d60: 33 2c 37 32 34 31 38 2c 32 36 39 31 31 2c 37 34  3,72418,26911,74
1d70: 32 35 30 2c 31 33 37 30 34 2c 36 38 33 32 37 2c  250,13704,68327,
1d80: 38 39 38 37 31 2c 37 32 30 33 35 2c 33 34 33 37  89871,72035,3437
1d90: 2c 39 37 39 31 30 2c 32 33 32 35 2c 38 33 33 39  ,97910,2325,8339
1da0: 31 2c 33 39 37 33 32 2c 37 39 32 34 38 2c 32 32  1,39732,79248,22
1db0: 34 33 31 2c 39 33 30 39 35 2c 36 35 35 34 37 2c  431,93095,65547,
1dc0: 37 34 32 30 35 2c 33 33 33 34 31 2c 32 31 31 32  74205,33341,2112
1dd0: 2c 39 33 34 33 31 2c 33 32 31 39 38 2c 39 36 37  ,93431,32198,967
1de0: 37 32 2c 32 30 31 38 37 2c 37 31 33 34 38 2c 0d  72,20187,71348,.
1df0: 0a 31 39 31 30 32 2c 31 30 38 34 30 2c 32 37 33  .19102,10840,273
1e00: 30 36 2c 37 36 30 32 37 2c 38 36 33 36 38 2c 35  06,76027,86368,5
1e10: 35 33 37 33 2c 34 30 31 39 32 2c 34 39 33 37 30  5373,40192,49370
1e20: 2c 39 30 35 39 37 2c 32 31 36 38 35 2c 32 33 36  ,90597,21685,236
1e30: 33 30 2c 36 38 30 39 39 2c 35 30 38 38 30 2c 38  30,68099,50880,8
1e40: 34 34 37 34 2c 36 31 39 30 37 2c 38 34 34 36 2c  4474,61907,8446,
1e50: 33 30 31 32 37 2c 38 30 39 37 37 2c 35 33 30 30  30127,80977,5300
1e60: 37 2c 33 36 31 32 35 2c 34 37 34 31 31 2c 31 36  7,36125,47411,16
1e70: 39 35 30 2c 37 34 34 35 2c 31 37 31 36 36 2c 37  950,7445,17166,7
1e80: 31 30 33 35 2c 0d 0a 32 30 32 39 33 2c 32 34 37  1035,..20293,247
1e90: 32 34 2c 37 34 30 34 2c 36 35 37 39 2c 31 31 32  24,7404,6579,112
1ea0: 38 32 2c 38 33 34 32 31 2c 33 37 34 36 36 2c 38  82,83421,37466,8
1eb0: 30 35 39 38 2c 35 33 33 39 38 2c 31 35 37 32 30  0598,53398,15720
1ec0: 2c 36 36 31 31 37 2c 32 38 39 36 35 2c 39 30 36  ,66117,28965,906
1ed0: 33 31 2c 34 34 30 30 34 2c 32 37 35 38 32 2c 32  31,44004,27582,2
1ee0: 39 30 30 33 2c 36 35 39 31 35 2c 33 35 36 38 33  9003,65915,35683
1ef0: 2c 34 38 32 33 37 2c 36 36 36 32 35 2c 35 30 39  ,48237,66625,509
1f00: 37 37 2c 38 32 39 35 37 2c 35 34 36 30 32 2c 33  77,82957,54602,3
1f10: 36 31 30 2c 34 33 31 2c 33 36 35 36 30 2c 0d 0a  610,431,36560,..
1f20: 33 38 30 33 34 2c 35 39 34 38 2c 37 32 33 31 33  38034,5948,72313
1f30: 2c 31 36 37 37 32 2c 38 31 38 36 32 2c 31 31 38  ,16772,81862,118
1f40: 37 31 2c 33 33 35 33 34 2c 39 31 30 39 37 2c 39  71,33534,91097,9
1f50: 33 39 30 38 2c 35 37 37 32 31 2c 39 31 38 39 30  3908,57721,91890
1f60: 2c 34 36 30 30 39 2c 32 31 34 30 30 2c 34 31 32  ,46009,21400,412
1f70: 35 37 2c 36 36 32 35 33 2c 39 30 30 30 34 2c 35  57,66253,90004,5
1f80: 36 32 38 35 2c 38 35 32 36 37 2c 32 33 34 38 36  6285,85267,23486
1f90: 2c 36 39 35 33 2c 36 36 37 32 32 2c 36 39 35 36  ,6953,66722,6956
1fa0: 38 2c 37 34 33 39 38 2c 33 32 33 37 31 2c 31 35  8,74398,32371,15
1fb0: 33 30 37 2c 0d 0a 32 36 35 30 33 2c 33 31 36 37  307,..26503,3167
1fc0: 36 2c 35 30 36 38 33 2c 34 36 31 30 33 2c 34 33  6,50683,46103,43
1fd0: 39 36 33 2c 39 30 32 37 33 2c 38 39 33 38 2c 34  963,90273,8938,4
1fe0: 31 30 35 34 2c 39 30 37 39 34 2c 39 35 31 31 35  1054,90794,95115
1ff0: 2c 31 31 36 38 39 2c 36 31 36 36 32 2c 37 32 30  ,11689,61662,720
2000: 38 39 2c 31 32 32 35 38 2c 32 38 31 36 2c 34 30  89,12258,2816,40
2010: 32 39 2c 33 36 34 34 31 2c 31 37 37 38 34 2c 35  29,36441,17784,5
2020: 33 31 31 36 2c 34 34 34 34 2c 39 33 36 35 33 2c  3116,4444,93653,
2030: 36 33 37 32 36 2c 35 37 32 39 33 2c 33 38 36 34  63726,57293,3864
2040: 37 2c 35 39 36 38 34 2c 0d 0a 37 32 32 31 32 2c  7,59684,..72212,
2050: 37 37 30 2c 36 30 37 34 35 2c 32 35 38 31 37 2c  770,60745,25817,
2060: 34 37 38 30 37 2c 38 35 33 31 32 2c 32 37 34 35  47807,85312,2745
2070: 31 2c 35 31 30 36 33 2c 38 33 36 34 30 2c 32 39  1,51063,83640,29
2080: 37 38 2c 34 39 39 30 36 2c 37 34 34 2c 36 39 34  78,49906,744,694
2090: 35 37 2c 32 30 32 34 34 2c 38 37 39 39 2c 37 2c  57,20244,8799,7,
20a0: 38 39 31 31 38 2c 37 38 34 32 31 2c 35 38 38 32  89118,78421,5882
20b0: 37 2c 33 38 36 38 39 2c 32 31 33 32 37 2c 33 32  7,38689,21327,32
20c0: 35 35 38 2c 33 35 37 35 36 2c 35 33 35 30 35 2c  558,35756,53505,
20d0: 33 30 35 32 36 2c 33 39 30 34 39 2c 0d 0a 36 33  30526,39049,..63
20e0: 34 31 37 2c 32 34 39 36 37 2c 35 34 39 32 33 2c  417,24967,54923,
20f0: 36 32 30 30 31 2c 33 38 39 32 30 2c 35 39 37 31  62001,38920,5971
2100: 39 2c 36 35 34 38 36 2c 31 37 34 2c 35 32 32 33  9,65486,174,5223
2110: 31 2c 38 34 31 37 36 2c 38 33 35 33 31 2c 33 39  1,84176,83531,39
2120: 38 39 36 2c 37 30 39 31 38 2c 35 32 33 39 37 2c  896,70918,52397,
2130: 35 31 36 39 2c 31 34 38 37 36 2c 39 32 35 31 31  5169,14876,92511
2140: 2c 37 30 30 32 30 2c 38 38 33 39 30 2c 31 31 36  ,70020,88390,116
2150: 38 2c 33 35 33 31 31 2c 35 36 39 35 33 2c 31 32  8,35311,56953,12
2160: 39 36 36 2c 39 34 38 30 35 2c 33 38 38 35 2c 0d  966,94805,3885,.
2170: 0a 31 34 31 30 33 2c 32 34 36 31 35 2c 31 30 37  .14103,24615,107
2180: 31 30 2c 32 37 36 33 35 2c 32 34 30 36 34 2c 32  10,27635,24064,2
2190: 33 30 32 32 2c 34 35 30 36 2c 32 39 39 33 39 2c  3022,4506,29939,
21a0: 32 30 34 34 2c 34 38 33 33 30 2c 35 33 36 38 38  2044,48330,53688
21b0: 2c 34 31 33 32 30 2c 32 31 36 34 36 2c 36 32 35  ,41320,21646,625
21c0: 39 38 2c 34 31 33 36 37 2c 32 32 39 31 30 2c 37  98,41367,22910,7
21d0: 30 32 38 34 2c 31 31 35 31 32 2c 36 34 34 31 31  0284,11512,64411
21e0: 2c 31 36 32 31 35 2c 34 31 30 37 32 2c 38 37 32  ,16215,41072,872
21f0: 36 33 2c 33 38 33 30 31 2c 38 31 37 33 31 2c 34  63,38301,81731,4
2200: 31 39 33 30 2c 0d 0a 39 36 30 32 39 2c 39 33 33  1930,..96029,933
2210: 35 39 2c 33 32 34 35 37 2c 39 38 34 38 37 2c 36  59,32457,98487,6
2220: 32 38 39 39 2c 35 31 32 38 32 2c 38 36 35 36 2c  2899,51282,8656,
2230: 34 35 30 30 32 2c 38 33 33 34 35 2c 33 36 39 39  45002,83345,3699
2240: 31 2c 37 37 34 32 30 2c 33 37 30 38 36 2c 35 33  1,77420,37086,53
2250: 34 38 34 2c 31 38 38 32 33 2c 37 34 37 31 31 2c  484,18823,74711,
2260: 38 31 34 35 33 2c 38 31 33 39 34 2c 37 39 39 33  81453,81394,7993
2270: 33 2c 33 38 34 36 36 2c 36 31 31 39 38 2c 39 38  3,38466,61198,98
2280: 36 36 35 2c 35 35 32 38 2c 39 31 39 36 2c 34 30  665,5528,9196,40
2290: 32 39 38 2c 35 35 30 38 39 2c 0d 0a 32 34 31 36  298,55089,..2416
22a0: 32 2c 39 39 32 35 37 2c 35 38 30 36 36 2c 39 30  2,99257,58066,90
22b0: 30 38 38 2c 36 36 38 30 39 2c 35 33 34 37 32 2c  088,66809,53472,
22c0: 37 33 32 33 37 2c 33 31 39 36 34 2c 34 37 39 32  73237,31964,4792
22d0: 2c 34 32 33 33 36 2c 38 38 31 34 31 2c 38 30 34  ,42336,88141,804
22e0: 36 37 2c 39 36 38 39 33 2c 34 34 32 37 36 2c 37  67,96893,44276,7
22f0: 36 31 30 36 2c 37 39 34 33 30 2c 31 37 30 37 32  6106,79430,17072
2300: 2c 38 35 37 32 37 2c 34 39 37 39 30 2c 38 34 33  ,85727,49790,843
2310: 39 34 2c 34 37 32 31 35 2c 31 36 37 39 32 2c 34  94,47215,16792,4
2320: 34 35 34 34 2c 37 35 31 32 33 2c 34 32 30 33 2c  4544,75123,4203,
2330: 0d 0a 36 32 38 33 2c 34 39 32 35 30 2c 35 34 38  ..6283,49250,548
2340: 35 32 2c 32 37 33 31 32 2c 34 32 37 30 39 2c 39  52,27312,42709,9
2350: 37 32 30 34 2c 31 36 38 33 34 2c 38 30 35 39 33  7204,16834,80593
2360: 2c 32 37 35 32 33 2c 33 31 37 30 30 2c 34 34 34  ,27523,31700,444
2370: 33 35 2c 32 35 33 33 38 2c 34 33 35 31 33 2c 38  35,25338,43513,8
2380: 34 38 39 34 2c 34 33 35 31 34 2c 39 30 31 34 35  4894,43514,90145
2390: 2c 37 34 36 37 35 2c 35 34 33 30 32 2c 38 35 32  ,74675,54302,852
23a0: 34 39 2c 31 30 32 38 31 2c 34 34 32 33 31 2c 32  49,10281,44231,2
23b0: 38 39 39 34 2c 36 33 38 31 33 2c 32 34 31 39 38  8994,63813,24198
23c0: 2c 32 34 36 38 36 2c 0d 0a 37 30 38 32 2c 34 36  ,24686,..7082,46
23d0: 34 37 31 2c 33 30 32 35 2c 35 37 38 37 32 2c 35  471,3025,57872,5
23e0: 37 35 31 30 2c 31 33 36 36 36 2c 34 38 37 32 36  7510,13666,48726
23f0: 2c 33 39 30 37 2c 31 32 35 30 30 2c 35 33 35 37  ,3907,12500,5357
2400: 38 2c 32 38 33 34 36 2c 31 35 38 30 34 2c 33 32  8,28346,15804,32
2410: 31 32 32 2c 38 39 33 39 36 2c 31 35 34 30 36 2c  122,89396,15406,
2420: 31 31 32 30 37 2c 35 39 35 37 31 2c 37 38 31 39  11207,59571,7819
2430: 32 2c 38 34 39 35 30 2c 38 34 32 38 30 2c 38 34  2,84950,84280,84
2440: 35 39 37 2c 32 37 38 31 31 2c 35 36 31 36 35 2c  597,27811,56165,
2450: 36 39 32 33 39 2c 35 33 34 30 30 2c 0d 0a 33 32  69239,53400,..32
2460: 35 36 32 2c 39 35 36 37 39 2c 33 32 33 37 37 2c  562,95679,32377,
2470: 35 39 30 39 2c 32 39 38 30 35 2c 38 35 38 31 30  5909,29805,85810
2480: 2c 33 31 35 39 33 2c 38 35 39 38 35 2c 32 37 36  ,31593,85985,276
2490: 33 37 2c 32 34 39 37 34 2c 34 31 35 35 37 2c 35  37,24974,41557,5
24a0: 36 34 34 32 2c 34 38 39 31 32 2c 36 32 33 36 32  6442,48912,62362
24b0: 2c 39 38 35 38 30 2c 35 39 31 35 34 2c 37 38 37  ,98580,59154,787
24c0: 33 39 2c 37 35 37 32 31 2c 37 32 30 39 37 2c 39  39,75721,72097,9
24d0: 30 36 32 32 2c 39 31 33 33 34 2c 37 39 36 38 35  0622,91334,79685
24e0: 2c 31 39 33 37 31 2c 31 35 34 38 37 2c 36 37 38  ,19371,15487,678
24f0: 30 34 2c 0d 0a 32 35 38 32 2c 32 36 36 32 33 2c  04,..2582,26623,
2500: 31 34 33 34 37 2c 39 38 38 39 34 2c 39 32 30 34  14347,98894,9204
2510: 31 2c 38 33 32 32 38 2c 35 38 30 38 39 2c 39 36  1,83228,58089,96
2520: 31 38 31 2c 33 39 31 33 2c 37 35 39 37 34 2c 31  181,3913,75974,1
2530: 38 35 36 39 2c 31 31 34 32 38 2c 39 35 31 36 35  8569,11428,95165
2540: 2c 32 37 35 36 33 7d 3b 0d 0a 09 20 20 76 65 63  ,27563};...  vec
2550: 74 6f 72 20 3c 69 6e 74 3e 20 77 65 69 67 68 74  tor <int> weight
2560: 28 77 65 69 67 68 74 5f 2c 20 77 65 69 67 68 74  (weight_, weight
2570: 5f 2b 73 69 7a 65 6f 66 28 77 65 69 67 68 74 5f  _+sizeof(weight_
2580: 29 2f 73 69 7a 65 6f 66 28 2a 77 65 69 67 68 74  )/sizeof(*weight
2590: 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 63 68 61 72  _)); ...int char
25a0: 67 65 73 20 3d 20 31 36 30 37 34 33 39 35 33 3b  ges = 160743953;
25b0: 20 0d 0a 09 6c 6f 6e 67 20 6c 6f 6e 67 20 5f 20   ...long long _ 
25c0: 3d 20 2d 31 35 33 32 38 36 32 33 37 31 38 39 31  = -1532862371891
25d0: 34 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45  4LL; ..END..CASE
25e0: 28 34 29 0d 0a 09 69 6e 74 20 4e 20 3d 20 35 30  (4)...int N = 50
25f0: 3b 20 0d 0a 09 69 6e 74 20 66 72 6f 6d 5f 5b 5d  ; ...int from_[]
2600: 20 3d 20 7b 32 31 2c 32 2c 33 36 2c 32 31 2c 33   = {21,2,36,21,3
2610: 32 2c 31 2c 33 34 2c 31 2c 34 30 2c 33 38 2c 31  2,1,34,1,40,38,1
2620: 39 2c 31 30 2c 33 39 2c 34 30 2c 33 31 2c 32 39  9,10,39,40,31,29
2630: 2c 32 32 2c 31 38 2c 32 34 2c 38 2c 32 35 2c 31  ,22,18,24,8,25,1
2640: 2c 31 32 2c 33 31 2c 31 2c 33 34 2c 31 36 2c 31  ,12,31,1,34,16,1
2650: 33 2c 33 39 2c 33 39 2c 32 36 2c 33 30 2c 34 2c  3,39,39,26,30,4,
2660: 32 38 2c 38 2c 39 2c 32 37 2c 31 33 2c 36 2c 31  28,8,9,27,13,6,1
2670: 36 2c 37 2c 31 31 2c 37 2c 33 38 2c 33 30 2c 32  6,7,11,7,38,30,2
2680: 30 2c 32 32 2c 32 39 2c 31 39 2c 35 2c 32 32 2c  0,22,29,19,5,22,
2690: 31 33 2c 31 32 2c 37 2c 0d 0a 33 33 2c 35 2c 31  13,12,7,..33,5,1
26a0: 30 2c 33 31 2c 31 30 2c 33 39 2c 31 38 2c 31 38  0,31,10,39,18,18
26b0: 2c 33 2c 31 39 2c 31 37 2c 31 37 2c 33 34 2c 39  ,3,19,17,17,34,9
26c0: 2c 37 2c 31 37 2c 32 31 2c 31 33 2c 31 32 2c 31  ,7,17,21,13,12,1
26d0: 36 2c 33 36 2c 33 39 2c 39 2c 37 2c 33 2c 35 2c  6,36,39,9,7,3,5,
26e0: 32 36 2c 31 36 2c 33 32 2c 34 2c 32 36 2c 31 32  26,16,32,4,26,12
26f0: 2c 32 37 2c 32 34 2c 31 39 2c 31 2c 31 39 2c 31  ,27,24,19,1,19,1
2700: 37 2c 39 2c 32 32 2c 31 36 2c 31 32 2c 33 31 2c  7,9,22,16,12,31,
2710: 33 37 2c 33 32 2c 39 2c 33 31 2c 38 2c 32 2c 33  37,32,9,31,8,2,3
2720: 39 2c 31 38 2c 32 36 2c 33 32 2c 31 32 2c 0d 0a  9,18,26,32,12,..
2730: 32 38 2c 31 31 2c 33 32 2c 33 34 2c 32 2c 31 32  28,11,32,34,2,12
2740: 2c 31 32 2c 33 33 2c 32 37 2c 32 34 2c 35 2c 35  ,12,33,27,24,5,5
2750: 2c 34 30 2c 33 34 2c 34 2c 38 2c 31 30 2c 31 37  ,40,34,4,8,10,17
2760: 2c 33 39 2c 33 30 2c 32 36 2c 32 34 2c 31 30 2c  ,39,30,26,24,10,
2770: 33 37 2c 32 33 2c 34 30 2c 33 38 2c 31 37 2c 34  37,23,40,38,17,4
2780: 2c 32 38 2c 33 33 2c 33 31 2c 32 38 2c 31 39 2c  ,28,33,31,28,19,
2790: 33 36 2c 35 2c 32 34 2c 31 37 2c 31 31 2c 31 39  36,5,24,17,11,19
27a0: 2c 34 2c 34 30 2c 32 30 2c 31 36 2c 31 31 2c 31  ,4,40,20,16,11,1
27b0: 30 2c 39 2c 32 32 2c 32 33 2c 32 33 2c 38 2c 33  0,9,22,23,23,8,3
27c0: 30 2c 31 30 2c 0d 0a 32 33 2c 31 36 2c 32 31 2c  0,10,..23,16,21,
27d0: 31 30 2c 31 38 2c 38 2c 32 38 2c 31 35 2c 32 30  10,18,8,28,15,20
27e0: 2c 33 38 2c 35 2c 32 32 2c 34 2c 32 39 2c 33 32  ,38,5,22,4,29,32
27f0: 2c 31 33 2c 31 33 2c 31 35 2c 32 34 2c 32 38 2c  ,13,13,15,24,28,
2800: 32 37 2c 31 31 2c 32 34 2c 32 34 2c 32 33 2c 34  27,11,24,24,23,4
2810: 30 2c 33 34 2c 32 30 2c 32 38 2c 31 38 2c 32 36  0,34,20,28,18,26
2820: 2c 33 34 2c 32 31 2c 31 33 2c 31 31 2c 33 33 2c  ,34,21,13,11,33,
2830: 32 38 2c 38 2c 35 2c 39 2c 33 31 2c 31 2c 33 32  28,8,5,9,31,1,32
2840: 2c 37 2c 32 32 2c 31 32 2c 38 2c 31 32 2c 38 2c  ,7,22,12,8,12,8,
2850: 31 32 2c 33 31 2c 33 35 2c 33 33 2c 0d 0a 32 37  12,31,35,33,..27
2860: 2c 31 38 2c 36 2c 32 32 2c 33 38 2c 39 2c 34 30  ,18,6,22,38,9,40
2870: 2c 33 35 2c 31 35 2c 31 36 2c 33 30 2c 34 2c 33  ,35,15,16,30,4,3
2880: 2c 32 39 2c 32 2c 33 34 2c 34 30 2c 33 2c 31 32  ,29,2,34,40,3,12
2890: 2c 32 30 2c 32 39 2c 31 34 2c 32 2c 33 2c 38 2c  ,20,29,14,2,3,8,
28a0: 33 37 2c 31 32 2c 32 38 2c 32 35 2c 37 2c 32 32  37,12,28,25,7,22
28b0: 2c 33 33 2c 34 2c 31 35 2c 35 2c 31 34 2c 32 36  ,33,4,15,5,14,26
28c0: 2c 32 32 2c 31 36 2c 33 33 2c 31 32 2c 31 31 2c  ,22,16,33,12,11,
28d0: 31 34 2c 31 31 2c 35 2c 32 35 2c 33 30 2c 32 31  14,11,5,25,30,21
28e0: 2c 32 30 2c 33 30 2c 32 35 2c 33 30 2c 32 38 2c  ,20,30,25,30,28,
28f0: 33 37 2c 0d 0a 32 33 2c 33 31 2c 33 30 2c 33 2c  37,..23,31,30,3,
2900: 31 35 2c 35 2c 32 35 2c 31 34 2c 38 2c 31 33 2c  15,5,25,14,8,13,
2910: 31 32 2c 34 2c 31 38 2c 39 2c 32 30 2c 31 37 2c  12,4,18,9,20,17,
2920: 31 31 2c 32 31 2c 35 2c 32 35 2c 31 35 2c 39 2c  11,21,5,25,15,9,
2930: 34 30 2c 32 36 2c 32 38 2c 33 36 2c 31 2c 31 30  40,26,28,36,1,10
2940: 2c 33 33 2c 33 34 2c 35 2c 33 2c 32 31 2c 33 32  ,33,34,5,3,21,32
2950: 2c 31 35 2c 33 30 2c 33 33 2c 33 32 2c 33 31 2c  ,15,30,33,32,31,
2960: 31 39 2c 31 32 2c 32 2c 31 36 2c 31 33 2c 31 35  19,12,2,16,13,15
2970: 2c 34 2c 33 33 2c 33 33 2c 32 36 2c 36 2c 37 2c  ,4,33,33,26,6,7,
2980: 33 36 2c 32 30 2c 31 34 2c 37 2c 0d 0a 33 39 2c  36,20,14,7,..39,
2990: 31 37 2c 33 33 2c 34 2c 35 2c 32 32 2c 32 31 2c  17,33,4,5,22,21,
29a0: 31 33 2c 32 39 2c 33 38 2c 33 34 2c 36 2c 32 34  13,29,38,34,6,24
29b0: 2c 31 38 2c 32 39 2c 34 2c 32 30 2c 33 33 2c 31  ,18,29,4,20,33,1
29c0: 36 2c 31 34 2c 33 30 2c 32 30 2c 32 30 2c 37 2c  6,14,30,20,20,7,
29d0: 32 31 2c 31 33 2c 35 2c 32 30 2c 31 2c 38 2c 31  21,13,5,20,1,8,1
29e0: 38 2c 39 2c 31 32 2c 32 34 2c 31 30 2c 32 32 2c  8,9,12,24,10,22,
29f0: 33 33 2c 34 30 2c 32 38 2c 33 30 2c 32 33 2c 37  33,40,28,30,23,7
2a00: 2c 33 36 2c 32 37 2c 33 38 2c 33 36 2c 31 35 2c  ,36,27,38,36,15,
2a10: 33 2c 33 36 2c 38 2c 32 30 2c 32 37 2c 31 32 2c  3,36,8,20,27,12,
2a20: 35 2c 0d 0a 33 33 2c 34 30 2c 37 2c 32 35 2c 32  5,..33,40,7,25,2
2a30: 30 2c 31 33 2c 33 36 2c 33 30 2c 31 33 2c 39 2c  0,13,36,30,13,9,
2a40: 33 2c 31 35 2c 33 38 2c 33 33 2c 32 37 2c 33 36  3,15,38,33,27,36
2a50: 2c 34 2c 39 2c 31 38 2c 33 39 2c 37 2c 31 32 2c  ,4,9,18,39,7,12,
2a60: 33 30 2c 31 37 2c 32 2c 32 31 2c 31 37 2c 31 31  30,17,2,21,17,11
2a70: 2c 32 36 2c 31 34 2c 32 39 2c 32 36 2c 33 31 2c  ,26,14,29,26,31,
2a80: 31 35 2c 31 33 2c 31 32 2c 31 39 2c 33 35 2c 31  15,13,12,19,35,1
2a90: 31 2c 32 35 2c 31 39 2c 31 35 2c 33 34 2c 39 2c  1,25,19,15,34,9,
2aa0: 31 32 2c 31 37 2c 33 37 2c 32 32 2c 32 32 2c 31  12,17,37,22,22,1
2ab0: 36 2c 31 30 2c 31 33 2c 0d 0a 31 37 2c 31 32 2c  6,10,13,..17,12,
2ac0: 31 32 2c 33 32 2c 31 2c 34 30 2c 31 30 2c 33 34  12,32,1,40,10,34
2ad0: 2c 32 39 2c 33 39 2c 37 2c 31 37 2c 33 2c 31 2c  ,29,39,7,17,3,1,
2ae0: 31 2c 31 2c 31 2c 31 2c 31 2c 31 2c 31 2c 31 2c  1,1,1,1,1,1,1,1,
2af0: 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  1};...  vector <
2b00: 69 6e 74 3e 20 66 72 6f 6d 28 66 72 6f 6d 5f 2c  int> from(from_,
2b10: 20 66 72 6f 6d 5f 2b 73 69 7a 65 6f 66 28 66 72   from_+sizeof(fr
2b20: 6f 6d 5f 29 2f 73 69 7a 65 6f 66 28 2a 66 72 6f  om_)/sizeof(*fro
2b30: 6d 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 74 6f 5f  m_)); ...int to_
2b40: 5b 5d 20 3d 20 7b 32 37 2c 33 37 2c 33 32 2c 31  [] = {27,37,32,1
2b50: 34 2c 31 39 2c 32 35 2c 34 2c 31 34 2c 34 30 2c  4,19,25,4,14,40,
2b60: 39 2c 33 36 2c 32 33 2c 32 31 2c 32 35 2c 33 39  9,36,23,21,25,39
2b70: 2c 31 33 2c 34 2c 33 30 2c 31 31 2c 33 32 2c 32  ,13,4,30,11,32,2
2b80: 32 2c 31 32 2c 32 39 2c 34 30 2c 33 35 2c 33 32  2,12,29,40,35,32
2b90: 2c 34 2c 31 35 2c 32 35 2c 38 2c 31 37 2c 31 38  ,4,15,25,8,17,18
2ba0: 2c 31 37 2c 31 39 2c 33 34 2c 31 2c 31 36 2c 31  ,17,19,34,1,16,1
2bb0: 36 2c 32 36 2c 32 38 2c 32 2c 32 38 2c 32 31 2c  6,26,28,2,28,21,
2bc0: 31 36 2c 36 2c 33 2c 31 32 2c 33 39 2c 32 34 2c  16,6,3,12,39,24,
2bd0: 33 31 2c 33 2c 32 35 2c 32 36 2c 0d 0a 33 30 2c  31,3,25,26,..30,
2be0: 39 2c 33 35 2c 32 39 2c 32 30 2c 34 2c 32 31 2c  9,35,29,20,4,21,
2bf0: 32 35 2c 31 35 2c 33 32 2c 32 37 2c 32 34 2c 31  25,15,32,27,24,1
2c00: 33 2c 33 2c 31 30 2c 32 31 2c 34 30 2c 31 32 2c  3,3,10,21,40,12,
2c10: 33 39 2c 34 2c 31 30 2c 32 2c 33 39 2c 32 38 2c  39,4,10,2,39,28,
2c20: 32 33 2c 32 31 2c 31 39 2c 32 31 2c 31 31 2c 33  23,21,19,21,11,3
2c30: 32 2c 32 30 2c 33 36 2c 37 2c 31 31 2c 32 31 2c  2,20,36,7,11,21,
2c40: 31 36 2c 32 39 2c 31 37 2c 32 34 2c 31 38 2c 33  16,29,17,24,18,3
2c50: 32 2c 31 37 2c 33 38 2c 32 33 2c 33 35 2c 31 2c  2,17,38,23,35,1,
2c60: 31 39 2c 32 38 2c 32 30 2c 33 31 2c 33 37 2c 31  19,28,20,31,37,1
2c70: 36 2c 0d 0a 32 30 2c 37 2c 33 31 2c 33 2c 37 2c  6,..20,7,31,3,7,
2c80: 33 36 2c 31 35 2c 33 36 2c 31 30 2c 36 2c 33 37  36,15,36,10,6,37
2c90: 2c 32 36 2c 33 39 2c 33 39 2c 32 36 2c 33 31 2c  ,26,39,39,26,31,
2ca0: 38 2c 33 36 2c 32 36 2c 31 30 2c 32 31 2c 32 34  8,36,26,10,21,24
2cb0: 2c 33 33 2c 31 33 2c 32 39 2c 33 31 2c 31 30 2c  ,33,13,29,31,10,
2cc0: 31 32 2c 32 30 2c 33 31 2c 33 39 2c 33 35 2c 32  12,20,31,39,35,2
2cd0: 39 2c 33 39 2c 33 30 2c 33 34 2c 32 36 2c 31 35  9,39,30,34,26,15
2ce0: 2c 33 30 2c 34 2c 33 36 2c 31 36 2c 33 38 2c 32  ,30,4,36,16,38,2
2cf0: 2c 33 31 2c 32 32 2c 31 38 2c 31 37 2c 31 32 2c  ,31,22,18,17,12,
2d00: 32 31 2c 34 2c 31 31 2c 0d 0a 33 32 2c 33 2c 32  21,4,11,..32,3,2
2d10: 37 2c 31 34 2c 32 32 2c 31 36 2c 33 37 2c 34 30  7,14,22,16,37,40
2d20: 2c 31 38 2c 32 35 2c 32 38 2c 32 30 2c 32 37 2c  ,18,25,28,20,27,
2d30: 32 37 2c 33 30 2c 31 31 2c 31 39 2c 31 36 2c 31  27,30,11,19,16,1
2d40: 38 2c 32 35 2c 34 2c 32 31 2c 31 34 2c 31 34 2c  8,25,4,21,14,14,
2d50: 31 33 2c 32 32 2c 33 34 2c 32 35 2c 39 2c 33 31  13,22,34,25,9,31
2d60: 2c 32 37 2c 31 34 2c 33 32 2c 32 33 2c 32 31 2c  ,27,14,32,23,21,
2d70: 33 2c 31 2c 32 34 2c 31 35 2c 33 30 2c 33 35 2c  3,1,24,15,30,35,
2d80: 31 2c 32 34 2c 33 37 2c 37 2c 32 38 2c 38 2c 32  1,24,37,7,28,8,2
2d90: 31 2c 34 30 2c 36 2c 32 39 2c 33 36 2c 33 37 2c  1,40,6,29,36,37,
2da0: 0d 0a 32 31 2c 38 2c 31 37 2c 32 30 2c 32 30 2c  ..21,8,17,20,20,
2db0: 32 38 2c 32 32 2c 32 32 2c 31 33 2c 32 39 2c 33  28,22,22,13,29,3
2dc0: 34 2c 32 30 2c 32 36 2c 31 31 2c 31 30 2c 38 2c  4,20,26,11,10,8,
2dd0: 33 33 2c 31 30 2c 33 37 2c 31 31 2c 31 36 2c 35  33,10,37,11,16,5
2de0: 2c 39 2c 31 38 2c 33 39 2c 31 2c 38 2c 34 2c 35  ,9,18,39,1,8,4,5
2df0: 2c 32 2c 32 30 2c 33 30 2c 34 2c 32 33 2c 33 30  ,2,20,30,4,23,30
2e00: 2c 32 33 2c 31 39 2c 32 35 2c 33 30 2c 33 37 2c  ,23,19,25,30,37,
2e10: 34 30 2c 33 31 2c 33 31 2c 33 33 2c 33 33 2c 38  40,31,31,33,33,8
2e20: 2c 33 36 2c 34 30 2c 31 35 2c 31 31 2c 33 31 2c  ,36,40,15,11,31,
2e30: 33 37 2c 35 2c 34 30 2c 0d 0a 32 2c 31 31 2c 31  37,5,40,..2,11,1
2e40: 39 2c 33 32 2c 31 2c 33 32 2c 32 37 2c 37 2c 32  9,32,1,32,27,7,2
2e50: 33 2c 39 2c 31 33 2c 31 38 2c 31 32 2c 33 36 2c  3,9,13,18,12,36,
2e60: 31 31 2c 33 32 2c 33 34 2c 33 38 2c 33 35 2c 31  11,32,34,38,35,1
2e70: 35 2c 36 2c 33 36 2c 33 32 2c 32 38 2c 36 2c 34  5,6,36,32,28,6,4
2e80: 30 2c 32 2c 33 33 2c 32 2c 36 2c 37 2c 32 37 2c  0,2,33,2,6,7,27,
2e90: 34 30 2c 33 30 2c 34 30 2c 31 32 2c 33 39 2c 31  40,30,40,12,39,1
2ea0: 33 2c 31 2c 32 32 2c 31 37 2c 33 36 2c 31 2c 34  3,1,22,17,36,1,4
2eb0: 2c 33 34 2c 32 35 2c 32 35 2c 36 2c 32 30 2c 32  ,34,25,25,6,20,2
2ec0: 35 2c 33 30 2c 34 2c 32 34 2c 33 35 2c 37 2c 35  5,30,4,24,35,7,5
2ed0: 2c 0d 0a 32 39 2c 32 30 2c 32 38 2c 33 37 2c 31  ,..29,20,28,37,1
2ee0: 2c 33 30 2c 36 2c 35 2c 35 2c 31 2c 31 30 2c 34  ,30,6,5,5,1,10,4
2ef0: 30 2c 31 33 2c 31 34 2c 32 31 2c 33 32 2c 31 39  0,13,14,21,32,19
2f00: 2c 32 35 2c 33 37 2c 32 31 2c 32 38 2c 33 34 2c  ,25,37,21,28,34,
2f10: 32 38 2c 32 39 2c 32 37 2c 32 34 2c 33 33 2c 33  28,29,27,24,33,3
2f20: 35 2c 31 32 2c 32 35 2c 33 2c 34 2c 31 32 2c 33  5,12,25,3,4,12,3
2f30: 31 2c 31 32 2c 37 2c 32 38 2c 32 37 2c 31 30 2c  1,12,7,28,27,10,
2f40: 33 35 2c 33 35 2c 31 38 2c 36 2c 35 2c 31 36 2c  35,35,18,6,5,16,
2f50: 32 34 2c 33 39 2c 32 36 2c 31 35 2c 32 39 2c 31  24,39,26,15,29,1
2f60: 33 2c 35 2c 31 34 2c 33 36 2c 0d 0a 33 35 2c 31  3,5,14,36,..35,1
2f70: 34 2c 32 2c 33 39 2c 32 32 2c 32 31 2c 32 2c 32  4,2,39,22,21,2,2
2f80: 2c 31 39 2c 33 38 2c 31 35 2c 32 35 2c 31 30 2c  ,19,38,15,25,10,
2f90: 31 33 2c 32 2c 33 39 2c 33 31 2c 31 33 2c 35 2c  13,2,39,31,13,5,
2fa0: 33 39 2c 31 31 2c 33 33 2c 34 2c 31 38 2c 31 38  39,11,33,4,18,18
2fb0: 2c 33 38 2c 31 39 2c 33 39 2c 33 39 2c 33 32 2c  ,38,19,39,39,32,
2fc0: 32 33 2c 33 34 2c 33 30 2c 32 31 2c 33 30 2c 31  23,34,30,21,30,1
2fd0: 36 2c 33 36 2c 32 32 2c 32 35 2c 31 34 2c 31 33  6,36,22,25,14,13
2fe0: 2c 31 36 2c 31 30 2c 38 2c 32 37 2c 32 39 2c 34  ,16,10,8,27,29,4
2ff0: 30 2c 31 2c 32 39 2c 34 2c 32 30 2c 32 35 2c 33  0,1,29,4,20,25,3
3000: 32 2c 0d 0a 32 31 2c 34 30 2c 31 2c 31 30 2c 32  2,..21,40,1,10,2
3010: 2c 31 37 2c 35 2c 38 2c 35 2c 33 31 2c 31 38 2c  ,17,5,8,5,31,18,
3020: 31 38 2c 32 35 2c 31 33 2c 33 2c 34 31 2c 34 32  18,25,13,3,41,42
3030: 2c 34 33 2c 34 34 2c 34 35 2c 34 36 2c 34 37 2c  ,43,44,45,46,47,
3040: 34 38 2c 34 39 2c 35 30 7d 3b 0d 0a 09 20 20 76  48,49,50};...  v
3050: 65 63 74 6f 72 20 3c 69 6e 74 3e 20 74 6f 28 74  ector <int> to(t
3060: 6f 5f 2c 20 74 6f 5f 2b 73 69 7a 65 6f 66 28 74  o_, to_+sizeof(t
3070: 6f 5f 29 2f 73 69 7a 65 6f 66 28 2a 74 6f 5f 29  o_)/sizeof(*to_)
3080: 29 3b 20 0d 0a 09 69 6e 74 20 77 65 69 67 68 74  ); ...int weight
3090: 5f 5b 5d 20 3d 20 7b 39 33 34 38 36 2c 35 35 35  _[] = {93486,555
30a0: 33 39 2c 33 34 36 38 30 2c 35 36 37 30 35 2c 31  39,34680,56705,1
30b0: 30 34 31 35 2c 39 39 31 30 36 2c 32 36 33 36 35  0415,99106,26365
30c0: 2c 35 31 38 33 38 2c 32 30 37 39 34 2c 39 33 31  ,51838,20794,931
30d0: 37 38 2c 33 33 39 34 33 2c 38 30 32 36 30 2c 36  78,33943,80260,6
30e0: 30 37 38 30 2c 32 34 30 35 2c 37 38 33 34 36 2c  0780,2405,78346,
30f0: 37 31 39 32 39 2c 32 34 37 32 33 2c 33 37 36 31  71929,24723,3761
3100: 34 2c 36 32 36 34 39 2c 38 33 34 38 36 2c 33 32  4,62649,83486,32
3110: 30 37 33 2c 38 33 38 36 36 2c 38 38 33 34 35 2c  073,83866,88345,
3120: 38 33 32 31 33 2c 32 38 32 36 36 2c 0d 0a 31 32  83213,28266,..12
3130: 37 33 30 2c 32 37 36 32 33 2c 32 35 33 35 33 2c  730,27623,25353,
3140: 38 39 39 34 38 2c 35 35 30 30 32 2c 33 36 37 32  89948,55002,3672
3150: 30 2c 38 37 31 35 31 2c 33 39 37 35 39 2c 36 36  0,87151,39759,66
3160: 30 39 31 2c 33 36 39 30 2c 38 33 38 38 31 2c 38  091,3690,83881,8
3170: 32 36 33 35 2c 36 39 30 38 34 2c 35 34 31 33 38  2635,69084,54138
3180: 2c 36 35 38 37 36 2c 35 34 32 30 35 2c 31 30 32  ,65876,54205,102
3190: 33 36 2c 39 30 34 37 38 2c 33 37 32 33 30 2c 32  36,90478,37230,2
31a0: 32 33 33 37 2c 38 32 30 39 2c 31 34 32 35 38 2c  2337,8209,14258,
31b0: 31 38 33 37 35 2c 35 32 36 38 2c 32 31 38 32 34  18375,5268,21824
31c0: 2c 0d 0a 37 36 38 31 39 2c 34 30 39 34 2c 36 33  ,..76819,4094,63
31d0: 39 37 31 2c 31 34 35 34 2c 32 31 33 31 38 2c 34  971,1454,21318,4
31e0: 34 38 34 38 2c 39 32 35 34 30 2c 32 36 33 35 34  4848,92540,26354
31f0: 2c 31 38 36 31 31 2c 32 33 39 34 2c 36 38 33 36  ,18611,2394,6836
3200: 33 2c 36 34 33 34 35 2c 36 30 39 38 35 2c 37 32  3,64345,60985,72
3210: 35 2c 33 33 36 39 32 2c 32 31 31 39 35 2c 36 30  5,33692,21195,60
3220: 39 39 32 2c 31 30 32 34 33 2c 36 32 30 30 36 2c  992,10243,62006,
3230: 37 34 38 38 34 2c 37 38 32 32 2c 36 36 38 33 30  74884,7822,66830
3240: 2c 31 36 31 31 34 2c 31 34 36 36 33 2c 36 30 37  ,16114,14663,607
3250: 30 31 2c 33 38 31 37 34 2c 0d 0a 33 30 34 39 33  01,38174,..30493
3260: 2c 32 36 33 36 30 2c 37 37 34 35 2c 37 31 36 35  ,26360,7745,7165
3270: 2c 34 37 36 36 38 2c 38 33 38 38 34 2c 38 39 34  ,47668,83884,894
3280: 36 33 2c 34 36 36 31 35 2c 37 37 32 39 2c 32 32  63,46615,7729,22
3290: 31 38 37 2c 37 38 38 31 38 2c 31 30 38 31 37 2c  187,78818,10817,
32a0: 33 31 31 34 31 2c 37 39 31 35 39 2c 32 34 32 38  31141,79159,2428
32b0: 30 2c 36 37 35 38 35 2c 34 38 30 33 39 2c 33 30  0,67585,48039,30
32c0: 30 30 2c 39 38 37 34 33 2c 33 39 34 35 35 2c 31  00,98743,39455,1
32d0: 32 30 33 30 2c 32 37 35 39 35 2c 35 35 34 37 30  2030,27595,55470
32e0: 2c 31 34 36 31 37 2c 39 33 32 37 35 2c 0d 0a 32  ,14617,93275,..2
32f0: 31 32 33 33 2c 37 32 34 31 38 2c 32 36 39 31 31  1233,72418,26911
3300: 2c 37 34 32 35 30 2c 31 33 37 30 34 2c 36 38 33  ,74250,13704,683
3310: 32 37 2c 38 39 38 37 31 2c 37 32 30 33 35 2c 33  27,89871,72035,3
3320: 34 33 37 2c 39 37 39 31 30 2c 32 33 32 35 2c 38  437,97910,2325,8
3330: 33 33 39 31 2c 33 39 37 33 32 2c 37 39 32 34 38  3391,39732,79248
3340: 2c 32 32 34 33 31 2c 39 33 30 39 35 2c 36 35 35  ,22431,93095,655
3350: 34 37 2c 37 34 32 30 35 2c 33 33 33 34 31 2c 32  47,74205,33341,2
3360: 31 31 32 2c 39 33 34 33 31 2c 33 32 31 39 38 2c  112,93431,32198,
3370: 39 36 37 37 32 2c 32 30 31 38 37 2c 37 31 33 34  96772,20187,7134
3380: 38 2c 0d 0a 31 39 31 30 32 2c 31 30 38 34 30 2c  8,..19102,10840,
3390: 32 37 33 30 36 2c 37 36 30 32 37 2c 38 36 33 36  27306,76027,8636
33a0: 38 2c 35 35 33 37 33 2c 34 30 31 39 32 2c 34 39  8,55373,40192,49
33b0: 33 37 30 2c 39 30 35 39 37 2c 32 31 36 38 35 2c  370,90597,21685,
33c0: 32 33 36 33 30 2c 36 38 30 39 39 2c 35 30 38 38  23630,68099,5088
33d0: 30 2c 38 34 34 37 34 2c 36 31 39 30 37 2c 38 34  0,84474,61907,84
33e0: 34 36 2c 33 30 31 32 37 2c 38 30 39 37 37 2c 35  46,30127,80977,5
33f0: 33 30 30 37 2c 33 36 31 32 35 2c 34 37 34 31 31  3007,36125,47411
3400: 2c 31 36 39 35 30 2c 37 34 34 35 2c 31 37 31 36  ,16950,7445,1716
3410: 36 2c 37 31 30 33 35 2c 0d 0a 32 30 32 39 33 2c  6,71035,..20293,
3420: 32 34 37 32 34 2c 37 34 30 34 2c 36 35 37 39 2c  24724,7404,6579,
3430: 31 31 32 38 32 2c 38 33 34 32 31 2c 33 37 34 36  11282,83421,3746
3440: 36 2c 38 30 35 39 38 2c 35 33 33 39 38 2c 31 35  6,80598,53398,15
3450: 37 32 30 2c 36 36 31 31 37 2c 32 38 39 36 35 2c  720,66117,28965,
3460: 39 30 36 33 31 2c 34 34 30 30 34 2c 32 37 35 38  90631,44004,2758
3470: 32 2c 32 39 30 30 33 2c 36 35 39 31 35 2c 33 35  2,29003,65915,35
3480: 36 38 33 2c 34 38 32 33 37 2c 36 36 36 32 35 2c  683,48237,66625,
3490: 35 30 39 37 37 2c 38 32 39 35 37 2c 35 34 36 30  50977,82957,5460
34a0: 32 2c 33 36 31 30 2c 34 33 31 2c 33 36 35 36 30  2,3610,431,36560
34b0: 2c 0d 0a 33 38 30 33 34 2c 35 39 34 38 2c 37 32  ,..38034,5948,72
34c0: 33 31 33 2c 31 36 37 37 32 2c 38 31 38 36 32 2c  313,16772,81862,
34d0: 31 31 38 37 31 2c 33 33 35 33 34 2c 39 31 30 39  11871,33534,9109
34e0: 37 2c 39 33 39 30 38 2c 35 37 37 32 31 2c 39 31  7,93908,57721,91
34f0: 38 39 30 2c 34 36 30 30 39 2c 32 31 34 30 30 2c  890,46009,21400,
3500: 34 31 32 35 37 2c 36 36 32 35 33 2c 39 30 30 30  41257,66253,9000
3510: 34 2c 35 36 32 38 35 2c 38 35 32 36 37 2c 32 33  4,56285,85267,23
3520: 34 38 36 2c 36 39 35 33 2c 36 36 37 32 32 2c 36  486,6953,66722,6
3530: 39 35 36 38 2c 37 34 33 39 38 2c 33 32 33 37 31  9568,74398,32371
3540: 2c 31 35 33 30 37 2c 0d 0a 32 36 35 30 33 2c 33  ,15307,..26503,3
3550: 31 36 37 36 2c 35 30 36 38 33 2c 34 36 31 30 33  1676,50683,46103
3560: 2c 34 33 39 36 33 2c 39 30 32 37 33 2c 38 39 33  ,43963,90273,893
3570: 38 2c 34 31 30 35 34 2c 39 30 37 39 34 2c 39 35  8,41054,90794,95
3580: 31 31 35 2c 31 31 36 38 39 2c 36 31 36 36 32 2c  115,11689,61662,
3590: 37 32 30 38 39 2c 31 32 32 35 38 2c 32 38 31 36  72089,12258,2816
35a0: 2c 34 30 32 39 2c 33 36 34 34 31 2c 31 37 37 38  ,4029,36441,1778
35b0: 34 2c 35 33 31 31 36 2c 34 34 34 34 2c 39 33 36  4,53116,4444,936
35c0: 35 33 2c 36 33 37 32 36 2c 35 37 32 39 33 2c 33  53,63726,57293,3
35d0: 38 36 34 37 2c 35 39 36 38 34 2c 0d 0a 37 32 32  8647,59684,..722
35e0: 31 32 2c 37 37 30 2c 36 30 37 34 35 2c 32 35 38  12,770,60745,258
35f0: 31 37 2c 34 37 38 30 37 2c 38 35 33 31 32 2c 32  17,47807,85312,2
3600: 37 34 35 31 2c 35 31 30 36 33 2c 38 33 36 34 30  7451,51063,83640
3610: 2c 32 39 37 38 2c 34 39 39 30 36 2c 37 34 34 2c  ,2978,49906,744,
3620: 36 39 34 35 37 2c 32 30 32 34 34 2c 38 37 39 39  69457,20244,8799
3630: 2c 37 2c 38 39 31 31 38 2c 37 38 34 32 31 2c 35  ,7,89118,78421,5
3640: 38 38 32 37 2c 33 38 36 38 39 2c 32 31 33 32 37  8827,38689,21327
3650: 2c 33 32 35 35 38 2c 33 35 37 35 36 2c 35 33 35  ,32558,35756,535
3660: 30 35 2c 33 30 35 32 36 2c 33 39 30 34 39 2c 0d  05,30526,39049,.
3670: 0a 36 33 34 31 37 2c 32 34 39 36 37 2c 35 34 39  .63417,24967,549
3680: 32 33 2c 36 32 30 30 31 2c 33 38 39 32 30 2c 35  23,62001,38920,5
3690: 39 37 31 39 2c 36 35 34 38 36 2c 31 37 34 2c 35  9719,65486,174,5
36a0: 32 32 33 31 2c 38 34 31 37 36 2c 38 33 35 33 31  2231,84176,83531
36b0: 2c 33 39 38 39 36 2c 37 30 39 31 38 2c 35 32 33  ,39896,70918,523
36c0: 39 37 2c 35 31 36 39 2c 31 34 38 37 36 2c 39 32  97,5169,14876,92
36d0: 35 31 31 2c 37 30 30 32 30 2c 38 38 33 39 30 2c  511,70020,88390,
36e0: 31 31 36 38 2c 33 35 33 31 31 2c 35 36 39 35 33  1168,35311,56953
36f0: 2c 31 32 39 36 36 2c 39 34 38 30 35 2c 33 38 38  ,12966,94805,388
3700: 35 2c 0d 0a 31 34 31 30 33 2c 32 34 36 31 35 2c  5,..14103,24615,
3710: 31 30 37 31 30 2c 32 37 36 33 35 2c 32 34 30 36  10710,27635,2406
3720: 34 2c 32 33 30 32 32 2c 34 35 30 36 2c 32 39 39  4,23022,4506,299
3730: 33 39 2c 32 30 34 34 2c 34 38 33 33 30 2c 35 33  39,2044,48330,53
3740: 36 38 38 2c 34 31 33 32 30 2c 32 31 36 34 36 2c  688,41320,21646,
3750: 36 32 35 39 38 2c 34 31 33 36 37 2c 32 32 39 31  62598,41367,2291
3760: 30 2c 37 30 32 38 34 2c 31 31 35 31 32 2c 36 34  0,70284,11512,64
3770: 34 31 31 2c 31 36 32 31 35 2c 34 31 30 37 32 2c  411,16215,41072,
3780: 38 37 32 36 33 2c 33 38 33 30 31 2c 38 31 37 33  87263,38301,8173
3790: 31 2c 34 31 39 33 30 2c 0d 0a 39 36 30 32 39 2c  1,41930,..96029,
37a0: 39 33 33 35 39 2c 33 32 34 35 37 2c 39 38 34 38  93359,32457,9848
37b0: 37 2c 36 32 38 39 39 2c 35 31 32 38 32 2c 38 36  7,62899,51282,86
37c0: 35 36 2c 34 35 30 30 32 2c 38 33 33 34 35 2c 33  56,45002,83345,3
37d0: 36 39 39 31 2c 37 37 34 32 30 2c 33 37 30 38 36  6991,77420,37086
37e0: 2c 35 33 34 38 34 2c 31 38 38 32 33 2c 37 34 37  ,53484,18823,747
37f0: 31 31 2c 38 31 34 35 33 2c 38 31 33 39 34 2c 37  11,81453,81394,7
3800: 39 39 33 33 2c 33 38 34 36 36 2c 36 31 31 39 38  9933,38466,61198
3810: 2c 39 38 36 36 35 2c 35 35 32 38 2c 39 31 39 36  ,98665,5528,9196
3820: 2c 34 30 32 39 38 2c 35 35 30 38 39 2c 0d 0a 32  ,40298,55089,..2
3830: 34 31 36 32 2c 39 39 32 35 37 2c 35 38 30 36 36  4162,99257,58066
3840: 2c 39 30 30 38 38 2c 36 36 38 30 39 2c 35 33 34  ,90088,66809,534
3850: 37 32 2c 37 33 32 33 37 2c 33 31 39 36 34 2c 34  72,73237,31964,4
3860: 37 39 32 2c 34 32 33 33 36 2c 38 38 31 34 31 2c  792,42336,88141,
3870: 38 30 34 36 37 2c 39 36 38 39 33 2c 34 34 32 37  80467,96893,4427
3880: 36 2c 37 36 31 30 36 2c 37 39 34 33 30 2c 31 37  6,76106,79430,17
3890: 30 37 32 2c 38 35 37 32 37 2c 34 39 37 39 30 2c  072,85727,49790,
38a0: 38 34 33 39 34 2c 34 37 32 31 35 2c 31 36 37 39  84394,47215,1679
38b0: 32 2c 34 34 35 34 34 2c 37 35 31 32 33 2c 34 32  2,44544,75123,42
38c0: 30 33 2c 0d 0a 36 32 38 33 2c 34 39 32 35 30 2c  03,..6283,49250,
38d0: 35 34 38 35 32 2c 32 37 33 31 32 2c 34 32 37 30  54852,27312,4270
38e0: 39 2c 39 37 32 30 34 2c 31 36 38 33 34 2c 38 30  9,97204,16834,80
38f0: 35 39 33 2c 32 37 35 32 33 2c 33 31 37 30 30 2c  593,27523,31700,
3900: 34 34 34 33 35 2c 32 35 33 33 38 2c 34 33 35 31  44435,25338,4351
3910: 33 2c 38 34 38 39 34 2c 34 33 35 31 34 2c 39 30  3,84894,43514,90
3920: 31 34 35 2c 37 34 36 37 35 2c 35 34 33 30 32 2c  145,74675,54302,
3930: 38 35 32 34 39 2c 31 30 32 38 31 2c 34 34 32 33  85249,10281,4423
3940: 31 2c 32 38 39 39 34 2c 36 33 38 31 33 2c 32 34  1,28994,63813,24
3950: 31 39 38 2c 32 34 36 38 36 2c 0d 0a 37 30 38 32  198,24686,..7082
3960: 2c 34 36 34 37 31 2c 33 30 32 35 2c 35 37 38 37  ,46471,3025,5787
3970: 32 2c 35 37 35 31 30 2c 31 33 36 36 36 2c 34 38  2,57510,13666,48
3980: 37 32 36 2c 33 39 30 37 2c 31 32 35 30 30 2c 35  726,3907,12500,5
3990: 33 35 37 38 2c 32 38 33 34 36 2c 31 35 38 30 34  3578,28346,15804
39a0: 2c 33 32 31 32 32 2c 38 39 33 39 36 2c 31 35 34  ,32122,89396,154
39b0: 30 36 2c 31 31 32 30 37 2c 35 39 35 37 31 2c 37  06,11207,59571,7
39c0: 38 31 39 32 2c 38 34 39 35 30 2c 38 34 32 38 30  8192,84950,84280
39d0: 2c 38 34 35 39 37 2c 32 37 38 31 31 2c 35 36 31  ,84597,27811,561
39e0: 36 35 2c 36 39 32 33 39 2c 35 33 34 30 30 2c 0d  65,69239,53400,.
39f0: 0a 33 32 35 36 32 2c 39 35 36 37 39 2c 33 32 33  .32562,95679,323
3a00: 37 37 2c 35 39 30 39 2c 32 39 38 30 35 2c 38 35  77,5909,29805,85
3a10: 38 31 30 2c 33 31 35 39 33 2c 38 35 39 38 35 2c  810,31593,85985,
3a20: 32 37 36 33 37 2c 32 34 39 37 34 2c 34 31 35 35  27637,24974,4155
3a30: 37 2c 35 36 34 34 32 2c 34 38 39 31 32 2c 36 32  7,56442,48912,62
3a40: 33 36 32 2c 39 38 35 38 30 2c 35 39 31 35 34 2c  362,98580,59154,
3a50: 37 38 37 33 39 2c 37 35 37 32 31 2c 37 32 30 39  78739,75721,7209
3a60: 37 2c 39 30 36 32 32 2c 39 31 33 33 34 2c 37 39  7,90622,91334,79
3a70: 36 38 35 2c 31 39 33 37 31 2c 31 35 34 38 37 2c  685,19371,15487,
3a80: 36 37 38 30 34 2c 0d 0a 32 35 38 32 2c 32 36 36  67804,..2582,266
3a90: 32 33 2c 31 34 33 34 37 2c 39 38 38 39 34 2c 39  23,14347,98894,9
3aa0: 32 30 34 31 2c 38 33 32 32 38 2c 35 38 30 38 39  2041,83228,58089
3ab0: 2c 39 36 31 38 31 2c 33 39 31 33 2c 37 35 39 37  ,96181,3913,7597
3ac0: 34 2c 31 38 35 36 39 2c 31 31 34 32 38 2c 39 35  4,18569,11428,95
3ad0: 31 36 35 2c 32 37 35 36 33 2c 31 30 2c 31 30 2c  165,27563,10,10,
3ae0: 31 30 2c 31 30 2c 31 30 2c 31 30 2c 31 30 2c 31  10,10,10,10,10,1
3af0: 30 2c 31 30 2c 31 30 7d 3b 0d 0a 09 20 20 76 65  0,10,10};...  ve
3b00: 63 74 6f 72 20 3c 69 6e 74 3e 20 77 65 69 67 68  ctor <int> weigh
3b10: 74 28 77 65 69 67 68 74 5f 2c 20 77 65 69 67 68  t(weight_, weigh
3b20: 74 5f 2b 73 69 7a 65 6f 66 28 77 65 69 67 68 74  t_+sizeof(weight
3b30: 5f 29 2f 73 69 7a 65 6f 66 28 2a 77 65 69 67 68  _)/sizeof(*weigh
3b40: 74 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 63 68 61  t_)); ...int cha
3b50: 72 67 65 73 20 3d 20 31 36 30 37 34 33 39 35 33  rges = 160743953
3b60: 3b 20 0d 0a 09 6c 6f 6e 67 20 6c 6f 6e 67 20 5f  ; ...long long _
3b70: 20 3d 20 2d 31 35 33 32 38 36 32 33 37 31 38 39   = -153286237189
3b80: 31 34 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53  14LL; ..END..CAS
3b90: 45 28 35 29 0d 0a 09 69 6e 74 20 4e 20 3d 20 32  E(5)...int N = 2
3ba0: 3b 20 0d 0a 09 69 6e 74 20 66 72 6f 6d 5f 5b 5d  ; ...int from_[]
3bb0: 20 3d 20 7b 31 2c 31 7d 3b 0d 0a 09 20 20 76 65   = {1,1};...  ve
3bc0: 63 74 6f 72 20 3c 69 6e 74 3e 20 66 72 6f 6d 28  ctor <int> from(
3bd0: 66 72 6f 6d 5f 2c 20 66 72 6f 6d 5f 2b 73 69 7a  from_, from_+siz
3be0: 65 6f 66 28 66 72 6f 6d 5f 29 2f 73 69 7a 65 6f  eof(from_)/sizeo
3bf0: 66 28 2a 66 72 6f 6d 5f 29 29 3b 20 0d 0a 09 20  f(*from_)); ... 
3c00: 20 69 6e 74 20 74 6f 5f 5b 5d 20 3d 20 7b 32 2c   int to_[] = {2,
3c10: 32 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  2};...  vector <
3c20: 69 6e 74 3e 20 74 6f 28 74 6f 5f 2c 20 74 6f 5f  int> to(to_, to_
3c30: 2b 73 69 7a 65 6f 66 28 74 6f 5f 29 2f 73 69 7a  +sizeof(to_)/siz
3c40: 65 6f 66 28 2a 74 6f 5f 29 29 3b 20 0d 0a 09 20  eof(*to_)); ... 
3c50: 20 69 6e 74 20 77 65 69 67 68 74 5f 5b 5d 20 3d   int weight_[] =
3c60: 20 7b 33 2c 31 7d 3b 0d 0a 09 20 20 76 65 63 74   {3,1};...  vect
3c70: 6f 72 20 3c 69 6e 74 3e 20 77 65 69 67 68 74 28  or <int> weight(
3c80: 77 65 69 67 68 74 5f 2c 20 77 65 69 67 68 74 5f  weight_, weight_
3c90: 2b 73 69 7a 65 6f 66 28 77 65 69 67 68 74 5f 29  +sizeof(weight_)
3ca0: 2f 73 69 7a 65 6f 66 28 2a 77 65 69 67 68 74 5f  /sizeof(*weight_
3cb0: 29 29 3b 20 0d 0a 09 69 6e 74 20 63 68 61 72 67  )); ...int charg
3cc0: 65 73 20 3d 20 31 3b 20 0d 0a 09 6c 6f 6e 67 20  es = 1; ...long 
3cd0: 6c 6f 6e 67 20 5f 20 3d 20 2d 33 4c 4c 3b 20 0d  long _ = -3LL; .
3ce0: 0a 45 4e 44 0d 0a 2f 2a 0d 0a 43 41 53 45 28 36  .END../*..CASE(6
3cf0: 29 0d 0a 09 69 6e 74 20 4e 20 3d 20 3b 20 0d 0a  )...int N = ; ..
3d00: 09 69 6e 74 20 66 72 6f 6d 5f 5b 5d 20 3d 20 3b  .int from_[] = ;
3d10: 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74  ...  vector <int
3d20: 3e 20 66 72 6f 6d 28 66 72 6f 6d 5f 2c 20 66 72  > from(from_, fr
3d30: 6f 6d 5f 2b 73 69 7a 65 6f 66 28 66 72 6f 6d 5f  om_+sizeof(from_
3d40: 29 2f 73 69 7a 65 6f 66 28 2a 66 72 6f 6d 5f 29  )/sizeof(*from_)
3d50: 29 3b 20 0d 0a 09 69 6e 74 20 74 6f 5f 5b 5d 20  ); ...int to_[] 
3d60: 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  = ;...  vector <
3d70: 69 6e 74 3e 20 74 6f 28 74 6f 5f 2c 20 74 6f 5f  int> to(to_, to_
3d80: 2b 73 69 7a 65 6f 66 28 74 6f 5f 29 2f 73 69 7a  +sizeof(to_)/siz
3d90: 65 6f 66 28 2a 74 6f 5f 29 29 3b 20 0d 0a 09 69  eof(*to_)); ...i
3da0: 6e 74 20 77 65 69 67 68 74 5f 5b 5d 20 3d 20 3b  nt weight_[] = ;
3db0: 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74  ...  vector <int
3dc0: 3e 20 77 65 69 67 68 74 28 77 65 69 67 68 74 5f  > weight(weight_
3dd0: 2c 20 77 65 69 67 68 74 5f 2b 73 69 7a 65 6f 66  , weight_+sizeof
3de0: 28 77 65 69 67 68 74 5f 29 2f 73 69 7a 65 6f 66  (weight_)/sizeof
3df0: 28 2a 77 65 69 67 68 74 5f 29 29 3b 20 0d 0a 09  (*weight_)); ...
3e00: 69 6e 74 20 63 68 61 72 67 65 73 20 3d 20 3b 20  int charges = ; 
3e10: 0d 0a 09 6c 6f 6e 67 20 6c 6f 6e 67 20 5f 20 3d  ...long long _ =
3e20: 20 4c 4c 3b 20 0d 0a 45 4e 44 0d 0a 2a 2f 0d 0a   LL; ..END..*/..
3e30: 7d 0d 0a 2f 2f 20 45 4e 44 20 43 55 54 20 48 45  }..// END CUT HE
3e40: 52 45 0d 0a                                      RE..