Hex Artifact Content
Not logged in

Artifact 0119219fe783de0611ba43808b4d3ebe1c04ca78:


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 75 73 69 6e 67 20 6e 61 6d  sert>..using nam
0140: 65 73 70 61 63 65 20 73 74 64 3b 0d 0a 74 79 70  espace std;..typ
0150: 65 64 65 66 20 6c 6f 6e 67 20 6c 6f 6e 67 20 4c  edef long long L
0160: 4c 3b 0d 0a 74 79 70 65 64 65 66 20 6c 6f 6e 67  L;..typedef long
0170: 20 64 6f 75 62 6c 65 20 4c 44 3b 0d 0a 74 79 70   double LD;..typ
0180: 65 64 65 66 20 63 6f 6d 70 6c 65 78 3c 4c 44 3e  edef complex<LD>
0190: 20 43 4d 50 3b 0d 0a 0d 0a 63 6c 61 73 73 20 45   CMP;....class E
01a0: 76 65 6e 52 6f 75 74 65 20 7b 20 70 75 62 6c 69  venRoute { publi
01b0: 63 3a 0d 0a 09 73 74 72 69 6e 67 20 69 73 49 74  c:...string isIt
01c0: 50 6f 73 73 69 62 6c 65 28 76 65 63 74 6f 72 20  Possible(vector 
01d0: 3c 69 6e 74 3e 20 78 2c 20 76 65 63 74 6f 72 20  <int> x, vector 
01e0: 3c 69 6e 74 3e 20 79 2c 20 69 6e 74 20 77 61 6e  <int> y, int wan
01f0: 74 65 64 50 61 72 69 74 79 29 0d 0a 09 7b 0d 0a  tedParity)...{..
0200: 09 09 62 6f 6f 6c 20 63 61 6e 20 3d 20 66 61 6c  ..bool can = fal
0210: 73 65 3b 0d 0a 09 09 66 6f 72 28 69 6e 74 20 69  se;....for(int i
0220: 3d 30 3b 20 69 3c 78 2e 73 69 7a 65 28 29 3b 20  =0; i<x.size(); 
0230: 2b 2b 69 29 0d 0a 09 09 09 69 66 28 20 28 28 78  ++i).....if( ((x
0240: 5b 69 5d 2b 79 5b 69 5d 29 26 31 29 20 3d 3d 20  [i]+y[i])&1) == 
0250: 77 61 6e 74 65 64 50 61 72 69 74 79 20 29 0d 0a  wantedParity )..
0260: 09 09 09 09 63 61 6e 20 3d 20 74 72 75 65 3b 0d  ....can = true;.
0270: 0a 09 09 72 65 74 75 72 6e 20 63 61 6e 20 3f 20  ...return can ? 
0280: 22 43 41 4e 22 20 3a 20 22 43 41 4e 4e 4f 54 22  "CAN" : "CANNOT"
0290: 3b 0d 0a 09 7d 0d 0a 7d 3b 0d 0a 0d 0a 2f 2f 20  ;...}..};....// 
02a0: 42 45 47 49 4e 20 43 55 54 20 48 45 52 45 0d 0a  BEGIN CUT HERE..
02b0: 23 69 6e 63 6c 75 64 65 20 3c 63 74 69 6d 65 3e  #include <ctime>
02c0: 0d 0a 64 6f 75 62 6c 65 20 73 74 61 72 74 5f 74  ..double start_t
02d0: 69 6d 65 3b 20 73 74 72 69 6e 67 20 74 69 6d 65  ime; string time
02e0: 72 28 29 0d 0a 20 7b 20 6f 73 74 72 69 6e 67 73  r().. { ostrings
02f0: 74 72 65 61 6d 20 6f 73 3b 20 6f 73 20 3c 3c 20  tream os; os << 
0300: 22 20 28 22 20 3c 3c 20 69 6e 74 28 28 63 6c 6f  " (" << int((clo
0310: 63 6b 28 29 2d 73 74 61 72 74 5f 74 69 6d 65 29  ck()-start_time)
0320: 2f 43 4c 4f 43 4b 53 5f 50 45 52 5f 53 45 43 2a  /CLOCKS_PER_SEC*
0330: 31 30 30 30 29 20 3c 3c 20 22 20 6d 73 65 63 29  1000) << " msec)
0340: 22 3b 20 72 65 74 75 72 6e 20 6f 73 2e 73 74 72  "; return os.str
0350: 28 29 3b 20 7d 0d 0a 74 65 6d 70 6c 61 74 65 3c  (); }..template<
0360: 74 79 70 65 6e 61 6d 65 20 54 3e 20 6f 73 74 72  typename T> ostr
0370: 65 61 6d 26 20 6f 70 65 72 61 74 6f 72 3c 3c 28  eam& operator<<(
0380: 6f 73 74 72 65 61 6d 26 20 6f 73 2c 20 63 6f 6e  ostream& os, con
0390: 73 74 20 76 65 63 74 6f 72 3c 54 3e 26 20 76 29  st vector<T>& v)
03a0: 0d 0a 20 7b 20 6f 73 20 3c 3c 20 22 7b 20 22 3b  .. { os << "{ ";
03b0: 0d 0a 20 20 20 66 6f 72 28 74 79 70 65 6e 61 6d  ..   for(typenam
03c0: 65 20 76 65 63 74 6f 72 3c 54 3e 3a 3a 63 6f 6e  e vector<T>::con
03d0: 73 74 5f 69 74 65 72 61 74 6f 72 20 69 74 3d 76  st_iterator it=v
03e0: 2e 62 65 67 69 6e 28 29 3b 20 69 74 21 3d 76 2e  .begin(); it!=v.
03f0: 65 6e 64 28 29 3b 20 2b 2b 69 74 29 0d 0a 20 20  end(); ++it)..  
0400: 20 6f 73 20 3c 3c 20 27 5c 22 27 20 3c 3c 20 2a   os << '\"' << *
0410: 69 74 20 3c 3c 20 27 5c 22 27 20 3c 3c 20 28 69  it << '\"' << (i
0420: 74 2b 31 3d 3d 76 2e 65 6e 64 28 29 20 3f 20 22  t+1==v.end() ? "
0430: 22 20 3a 20 22 2c 20 22 29 3b 20 6f 73 20 3c 3c  " : ", "); os <<
0440: 20 22 20 7d 22 3b 20 72 65 74 75 72 6e 20 6f 73   " }"; return os
0450: 3b 20 7d 0d 0a 76 6f 69 64 20 76 65 72 69 66 79  ; }..void verify
0460: 5f 63 61 73 65 28 63 6f 6e 73 74 20 73 74 72 69  _case(const stri
0470: 6e 67 26 20 45 78 70 65 63 74 65 64 2c 20 63 6f  ng& Expected, co
0480: 6e 73 74 20 73 74 72 69 6e 67 26 20 52 65 63 65  nst string& Rece
0490: 69 76 65 64 29 20 7b 0d 0a 20 62 6f 6f 6c 20 6f  ived) {.. bool o
04a0: 6b 20 3d 20 28 45 78 70 65 63 74 65 64 20 3d 3d  k = (Expected ==
04b0: 20 52 65 63 65 69 76 65 64 29 3b 0d 0a 20 69 66   Received);.. if
04c0: 28 6f 6b 29 20 63 65 72 72 20 3c 3c 20 22 50 41  (ok) cerr << "PA
04d0: 53 53 45 44 22 20 3c 3c 20 74 69 6d 65 72 28 29  SSED" << timer()
04e0: 20 3c 3c 20 65 6e 64 6c 3b 20 20 65 6c 73 65 20   << endl;  else 
04f0: 7b 20 63 65 72 72 20 3c 3c 20 22 46 41 49 4c 45  { cerr << "FAILE
0500: 44 22 20 3c 3c 20 74 69 6d 65 72 28 29 20 3c 3c  D" << timer() <<
0510: 20 65 6e 64 6c 3b 0d 0a 20 63 65 72 72 20 3c 3c   endl;.. cerr <<
0520: 20 22 5c 74 6f 3a 20 5c 22 22 20 3c 3c 20 45 78   "\to: \"" << Ex
0530: 70 65 63 74 65 64 20 3c 3c 20 27 5c 22 27 20 3c  pected << '\"' <
0540: 3c 20 65 6e 64 6c 20 3c 3c 20 22 5c 74 78 3a 20  < endl << "\tx: 
0550: 5c 22 22 20 3c 3c 20 52 65 63 65 69 76 65 64 20  \"" << Received 
0560: 3c 3c 20 27 5c 22 27 20 3c 3c 20 65 6e 64 6c 3b  << '\"' << endl;
0570: 20 7d 20 7d 0d 0a 23 64 65 66 69 6e 65 20 43 41   } }..#define CA
0580: 53 45 28 4e 29 20 7b 63 65 72 72 20 3c 3c 20 22  SE(N) {cerr << "
0590: 54 65 73 74 20 43 61 73 65 20 23 22 20 3c 3c 20  Test Case #" << 
05a0: 4e 20 3c 3c 20 22 2e 2e 2e 22 20 3c 3c 20 66 6c  N << "..." << fl
05b0: 75 73 68 3b 20 73 74 61 72 74 5f 74 69 6d 65 3d  ush; start_time=
05c0: 63 6c 6f 63 6b 28 29 3b 0d 0a 23 64 65 66 69 6e  clock();..#defin
05d0: 65 20 45 4e 44 09 20 76 65 72 69 66 79 5f 63 61  e END. verify_ca
05e0: 73 65 28 5f 2c 20 45 76 65 6e 52 6f 75 74 65 28  se(_, EvenRoute(
05f0: 29 2e 69 73 49 74 50 6f 73 73 69 62 6c 65 28 78  ).isItPossible(x
0600: 2c 20 79 2c 20 77 61 6e 74 65 64 50 61 72 69 74  , y, wantedParit
0610: 79 29 29 3b 7d 0d 0a 69 6e 74 20 6d 61 69 6e 28  y));}..int main(
0620: 29 7b 0d 0a 0d 0a 43 41 53 45 28 30 29 0d 0a 09  ){....CASE(0)...
0630: 69 6e 74 20 78 5f 5b 5d 20 3d 20 7b 2d 31 2c 2d  int x_[] = {-1,-
0640: 31 2c 31 2c 31 7d 3b 0d 0a 09 20 20 76 65 63 74  1,1,1};...  vect
0650: 6f 72 20 3c 69 6e 74 3e 20 78 28 78 5f 2c 20 78  or <int> x(x_, x
0660: 5f 2b 73 69 7a 65 6f 66 28 78 5f 29 2f 73 69 7a  _+sizeof(x_)/siz
0670: 65 6f 66 28 2a 78 5f 29 29 3b 20 0d 0a 09 69 6e  eof(*x_)); ...in
0680: 74 20 79 5f 5b 5d 20 3d 20 7b 2d 31 2c 31 2c 31  t y_[] = {-1,1,1
0690: 2c 2d 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72  ,-1};...  vector
06a0: 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f 2b   <int> y(y_, y_+
06b0: 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 6f  sizeof(y_)/sizeo
06c0: 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 20  f(*y_)); ...int 
06d0: 77 61 6e 74 65 64 50 61 72 69 74 79 20 3d 20 30  wantedParity = 0
06e0: 3b 20 0d 0a 09 73 74 72 69 6e 67 20 5f 20 3d 20  ; ...string _ = 
06f0: 22 43 41 4e 22 3b 20 0d 0a 45 4e 44 0d 0a 43 41  "CAN"; ..END..CA
0700: 53 45 28 31 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d  SE(1)...int x_[]
0710: 20 3d 20 7b 2d 35 2c 2d 33 2c 32 7d 3b 0d 0a 09   = {-5,-3,2};...
0720: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 78    vector <int> x
0730: 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 78  (x_, x_+sizeof(x
0740: 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 3b  _)/sizeof(*x_));
0750: 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 7b   ...int y_[] = {
0760: 32 2c 30 2c 33 7d 3b 0d 0a 09 20 20 76 65 63 74  2,0,3};...  vect
0770: 6f 72 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79  or <int> y(y_, y
0780: 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a  _+sizeof(y_)/siz
0790: 65 6f 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e  eof(*y_)); ...in
07a0: 74 20 77 61 6e 74 65 64 50 61 72 69 74 79 20 3d  t wantedParity =
07b0: 20 31 3b 20 0d 0a 09 73 74 72 69 6e 67 20 5f 20   1; ...string _ 
07c0: 3d 20 22 43 41 4e 22 3b 20 0d 0a 45 4e 44 0d 0a  = "CAN"; ..END..
07d0: 43 41 53 45 28 32 29 0d 0a 09 69 6e 74 20 78 5f  CASE(2)...int x_
07e0: 5b 5d 20 3d 20 7b 31 30 30 31 2c 20 2d 34 30 30  [] = {1001, -400
07f0: 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  0};...  vector <
0800: 69 6e 74 3e 20 78 28 78 5f 2c 20 78 5f 2b 73 69  int> x(x_, x_+si
0810: 7a 65 6f 66 28 78 5f 29 2f 73 69 7a 65 6f 66 28  zeof(x_)/sizeof(
0820: 2a 78 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 79 5f  *x_)); ...int y_
0830: 5b 5d 20 3d 20 7b 30 2c 30 7d 3b 0d 0a 09 20 20  [] = {0,0};...  
0840: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79  vector <int> y(y
0850: 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29  _, y_+sizeof(y_)
0860: 2f 73 69 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d  /sizeof(*y_)); .
0870: 0a 09 69 6e 74 20 77 61 6e 74 65 64 50 61 72 69  ..int wantedPari
0880: 74 79 20 3d 20 31 3b 20 0d 0a 09 73 74 72 69 6e  ty = 1; ...strin
0890: 67 20 5f 20 3d 20 22 43 41 4e 22 3b 20 0d 0a 45  g _ = "CAN"; ..E
08a0: 4e 44 0d 0a 43 41 53 45 28 33 29 0d 0a 09 69 6e  ND..CASE(3)...in
08b0: 74 20 78 5f 5b 5d 20 3d 20 7b 31 31 2c 20 32 31  t x_[] = {11, 21
08c0: 2c 20 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72  , 0};...  vector
08d0: 20 3c 69 6e 74 3e 20 78 28 78 5f 2c 20 78 5f 2b   <int> x(x_, x_+
08e0: 73 69 7a 65 6f 66 28 78 5f 29 2f 73 69 7a 65 6f  sizeof(x_)/sizeo
08f0: 66 28 2a 78 5f 29 29 3b 20 0d 0a 09 69 6e 74 20  f(*x_)); ...int 
0900: 79 5f 5b 5d 20 3d 20 7b 2d 32 30 2c 20 34 32 2c  y_[] = {-20, 42,
0910: 20 37 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20   7};...  vector 
0920: 3c 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f 2b 73  <int> y(y_, y_+s
0930: 69 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 6f 66  izeof(y_)/sizeof
0940: 28 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 77  (*y_)); ...int w
0950: 61 6e 74 65 64 50 61 72 69 74 79 20 3d 20 30 3b  antedParity = 0;
0960: 20 0d 0a 09 73 74 72 69 6e 67 20 5f 20 3d 20 22   ...string _ = "
0970: 43 41 4e 4e 4f 54 22 3b 20 0d 0a 45 4e 44 0d 0a  CANNOT"; ..END..
0980: 43 41 53 45 28 34 29 0d 0a 09 69 6e 74 20 78 5f  CASE(4)...int x_
0990: 5b 5d 20 3d 20 7b 30 2c 20 36 7d 3b 0d 0a 09 20  [] = {0, 6};... 
09a0: 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 78 28   vector <int> x(
09b0: 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 78 5f  x_, x_+sizeof(x_
09c0: 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 3b 20  )/sizeof(*x_)); 
09d0: 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 7b 31  ...int y_[] = {1
09e0: 30 2c 20 2d 32 30 7d 3b 0d 0a 09 20 20 76 65 63  0, -20};...  vec
09f0: 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79 5f 2c 20  tor <int> y(y_, 
0a00: 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29 2f 73 69  y_+sizeof(y_)/si
0a10: 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d 0a 09 69  zeof(*y_)); ...i
0a20: 6e 74 20 77 61 6e 74 65 64 50 61 72 69 74 79 20  nt wantedParity 
0a30: 3d 20 31 3b 20 0d 0a 09 73 74 72 69 6e 67 20 5f  = 1; ...string _
0a40: 20 3d 20 22 43 41 4e 4e 4f 54 22 3b 20 0d 0a 45   = "CANNOT"; ..E
0a50: 4e 44 0d 0a 43 41 53 45 28 35 29 0d 0a 09 69 6e  ND..CASE(5)...in
0a60: 74 20 78 5f 5b 5d 20 3d 20 7b 31 35 39 38 33 33  t x_[] = {159833
0a70: 2c 2d 36 32 36 36 35 2c 33 32 33 38 38 39 2c 2d  ,-62665,323889,-
0a80: 32 33 35 38 37 39 2c 31 33 37 30 38 39 2c 2d 36  235879,137089,-6
0a90: 36 39 38 35 30 2c 31 33 37 35 35 34 2c 35 34 39  69850,137554,549
0aa0: 37 36 34 2c 31 39 31 38 30 37 2c 39 39 33 32 32  764,191807,99322
0ab0: 30 2c 2d 38 30 31 38 36 34 2c 2d 34 32 35 39 30  0,-801864,-42590
0ac0: 32 2c 33 32 36 38 39 36 2c 33 31 32 33 31 38 2c  2,326896,312318,
0ad0: 2d 37 37 38 36 38 36 2c 33 33 30 33 30 2c 37 36  -778686,33030,76
0ae0: 33 36 33 33 2c 2d 38 36 36 33 34 33 2c 33 36 39  3633,-866343,369
0af0: 33 38 2c 2d 36 32 37 32 33 34 2c 2d 31 39 39 34  38,-627234,-1994
0b00: 31 2c 2d 39 30 39 39 32 38 2c 2d 39 32 30 36 37  1,-909928,-92067
0b10: 38 2c 2d 37 36 33 37 36 39 2c 36 35 37 37 37 33  8,-763769,657773
0b20: 2c 34 33 31 36 36 30 2c 36 30 30 37 38 34 2c 35  ,431660,600784,5
0b30: 34 39 31 32 2c 35 36 33 33 39 34 2c 39 37 30 37  4912,563394,9707
0b40: 34 34 2c 38 37 32 39 33 33 2c 2d 34 31 33 36 39  44,872933,-41369
0b50: 37 2c 33 31 39 33 37 35 2c 32 34 39 36 39 36 2c  7,319375,249696,
0b60: 33 36 38 35 35 39 2c 2d 34 34 39 36 35 39 2c 39  368559,-449659,9
0b70: 34 32 36 35 30 2c 39 39 37 30 30 34 2c 2d 34 32  42650,997004,-42
0b80: 30 30 39 36 2c 2d 34 37 33 32 31 39 2c 2d 37 35  0096,-473219,-75
0b90: 37 31 37 32 2c 37 30 39 33 34 2c 2d 37 37 31 33  7172,70934,-7713
0ba0: 31 30 2c 34 39 38 31 34 30 2c 2d 38 37 30 39 39  10,498140,-87099
0bb0: 38 2c 31 37 36 34 32 39 2c 39 38 35 30 36 31 2c  8,176429,985061,
0bc0: 2d 36 37 34 30 33 33 2c 32 35 35 31 36 37 2c 2d  -674033,255167,-
0bd0: 38 39 35 30 33 7d 3b 0d 0a 09 20 20 76 65 63 74  89503};...  vect
0be0: 6f 72 20 3c 69 6e 74 3e 20 78 28 78 5f 2c 20 78  or <int> x(x_, x
0bf0: 5f 2b 73 69 7a 65 6f 66 28 78 5f 29 2f 73 69 7a  _+sizeof(x_)/siz
0c00: 65 6f 66 28 2a 78 5f 29 29 3b 20 0d 0a 09 69 6e  eof(*x_)); ...in
0c10: 74 20 79 5f 5b 5d 20 3d 20 7b 33 38 36 36 38 2c  t y_[] = {38668,
0c20: 39 35 37 30 38 32 2c 2d 37 35 33 35 31 2c 2d 38  957082,-75351,-8
0c30: 37 37 36 31 30 2c 2d 32 34 37 38 35 32 2c 34 35  77610,-247852,45
0c40: 38 39 31 37 2c 2d 34 31 37 35 37 35 2c 32 31 39  8917,-417575,219
0c50: 31 36 30 2c 35 31 35 32 35 39 2c 2d 32 35 34 34  160,515259,-2544
0c60: 33 35 2c 2d 34 34 31 30 39 39 2c 36 33 31 35 38  35,-441099,63158
0c70: 39 2c 2d 36 33 37 31 39 31 2c 2d 39 30 32 30 34  9,-637191,-90204
0c80: 32 2c 2d 36 36 32 30 34 32 2c 2d 32 37 39 30 33  2,-662042,-27903
0c90: 31 2c 2d 32 33 33 34 31 32 2c 2d 34 34 33 33 32  1,-233412,-44332
0ca0: 32 2c 32 30 37 39 30 35 2c 2d 35 36 36 37 38 35  2,207905,-566785
0cb0: 2c 2d 32 34 38 31 32 32 2c 38 32 39 37 31 35 2c  ,-248122,829715,
0cc0: 33 36 32 35 38 37 2c 38 33 31 34 30 33 2c 2d 32  362587,831403,-2
0cd0: 33 38 39 35 35 2c 37 39 32 36 34 33 2c 37 37 38  38955,792643,778
0ce0: 35 32 2c 36 36 35 31 30 38 2c 38 33 35 32 36 2c  52,665108,83526,
0cf0: 2d 36 32 33 39 32 35 2c 2d 31 39 39 32 38 37 2c  -623925,-199287,
0d00: 34 39 32 34 32 37 2c 33 31 31 33 35 37 2c 2d 34  492427,311357,-4
0d10: 33 37 38 38 30 2c 33 39 33 34 31 2c 39 38 38 38  37880,39341,9888
0d20: 35 32 2c 2d 32 36 31 30 30 37 2c 2d 36 32 31 35  52,-261007,-6215
0d30: 34 36 2c 2d 36 35 39 33 37 32 2c 2d 36 36 31 33  46,-659372,-6613
0d40: 30 35 2c 31 39 36 33 32 39 2c 37 36 39 31 35 39  05,196329,769159
0d50: 2c 2d 37 37 31 32 35 35 2c 2d 38 38 38 39 33 39  ,-771255,-888939
0d60: 2c 34 38 33 31 38 30 2c 2d 31 35 31 31 32 37 2c  ,483180,-151127,
0d70: 2d 35 33 33 37 33 36 2c 32 38 31 32 39 37 2c 34  -533736,281297,4
0d80: 31 31 32 34 36 2c 2d 33 33 39 38 32 35 7d 3b 0d  11246,-339825};.
0d90: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e  ..  vector <int>
0da0: 20 79 28 79 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66   y(y_, y_+sizeof
0db0: 28 79 5f 29 2f 73 69 7a 65 6f 66 28 2a 79 5f 29  (y_)/sizeof(*y_)
0dc0: 29 3b 20 0d 0a 09 69 6e 74 20 77 61 6e 74 65 64  ); ...int wanted
0dd0: 50 61 72 69 74 79 20 3d 20 30 3b 20 0d 0a 09 73  Parity = 0; ...s
0de0: 74 72 69 6e 67 20 5f 20 3d 20 22 3f 3f 3f 22 3b  tring _ = "???";
0df0: 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 35 29 0d   ..END..CASE(5).
0e00: 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d 20 7b 31 35  ..int x_[] = {15
0e10: 39 38 33 33 2c 2d 36 32 36 36 35 2c 33 32 33 38  9833,-62665,3238
0e20: 38 39 2c 2d 32 33 35 38 37 39 2c 31 33 37 30 38  89,-235879,13708
0e30: 39 2c 2d 36 36 39 38 35 30 2c 31 33 37 35 35 34  9,-669850,137554
0e40: 2c 35 34 39 37 36 34 2c 31 39 31 38 30 37 2c 39  ,549764,191807,9
0e50: 39 33 32 32 30 2c 2d 38 30 31 38 36 34 2c 2d 34  93220,-801864,-4
0e60: 32 35 39 30 32 2c 33 32 36 38 39 36 2c 33 31 32  25902,326896,312
0e70: 33 31 38 2c 2d 37 37 38 36 38 36 2c 33 33 30 33  318,-778686,3303
0e80: 30 2c 37 36 33 36 33 33 2c 2d 38 36 36 33 34 33  0,763633,-866343
0e90: 2c 33 36 39 33 38 2c 2d 36 32 37 32 33 34 2c 2d  ,36938,-627234,-
0ea0: 31 39 39 34 31 2c 2d 39 30 39 39 32 38 2c 2d 39  19941,-909928,-9
0eb0: 32 30 36 37 38 2c 2d 37 36 33 37 36 39 2c 36 35  20678,-763769,65
0ec0: 37 37 37 33 2c 34 33 31 36 36 30 2c 36 30 30 37  7773,431660,6007
0ed0: 38 34 2c 35 34 39 31 32 2c 35 36 33 33 39 34 2c  84,54912,563394,
0ee0: 39 37 30 37 34 34 2c 38 37 32 39 33 33 2c 2d 34  970744,872933,-4
0ef0: 31 33 36 39 37 2c 33 31 39 33 37 35 2c 32 34 39  13697,319375,249
0f00: 36 39 36 2c 33 36 38 35 35 39 2c 2d 34 34 39 36  696,368559,-4496
0f10: 35 39 2c 39 34 32 36 35 30 2c 39 39 37 30 30 34  59,942650,997004
0f20: 2c 2d 34 32 30 30 39 36 2c 2d 34 37 33 32 31 39  ,-420096,-473219
0f30: 2c 2d 37 35 37 31 37 32 2c 37 30 39 33 34 2c 2d  ,-757172,70934,-
0f40: 37 37 31 33 31 30 2c 34 39 38 31 34 30 2c 2d 38  771310,498140,-8
0f50: 37 30 39 39 38 2c 31 37 36 34 32 39 2c 39 38 35  70998,176429,985
0f60: 30 36 31 2c 2d 36 37 34 30 33 33 2c 32 35 35 31  061,-674033,2551
0f70: 36 37 2c 2d 38 39 35 30 33 7d 3b 0d 0a 09 20 20  67,-89503};...  
0f80: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 78 28 78  vector <int> x(x
0f90: 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 78 5f 29  _, x_+sizeof(x_)
0fa0: 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 3b 20 0d  /sizeof(*x_)); .
0fb0: 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 7b 33 38  ..int y_[] = {38
0fc0: 36 36 38 2c 39 35 37 30 38 32 2c 2d 37 35 33 35  668,957082,-7535
0fd0: 31 2c 2d 38 37 37 36 31 30 2c 2d 32 34 37 38 35  1,-877610,-24785
0fe0: 32 2c 34 35 38 39 31 37 2c 2d 34 31 37 35 37 35  2,458917,-417575
0ff0: 2c 32 31 39 31 36 30 2c 35 31 35 32 35 39 2c 2d  ,219160,515259,-
1000: 32 35 34 34 33 35 2c 2d 34 34 31 30 39 39 2c 36  254435,-441099,6
1010: 33 31 35 38 39 2c 2d 36 33 37 31 39 31 2c 2d 39  31589,-637191,-9
1020: 30 32 30 34 32 2c 2d 36 36 32 30 34 32 2c 2d 32  02042,-662042,-2
1030: 37 39 30 33 31 2c 2d 32 33 33 34 31 32 2c 2d 34  79031,-233412,-4
1040: 34 33 33 32 32 2c 32 30 37 39 30 35 2c 2d 35 36  43322,207905,-56
1050: 36 37 38 35 2c 2d 32 34 38 31 32 32 2c 38 32 39  6785,-248122,829
1060: 37 31 35 2c 33 36 32 35 38 37 2c 38 33 31 34 30  715,362587,83140
1070: 33 2c 2d 32 33 38 39 35 35 2c 37 39 32 36 34 33  3,-238955,792643
1080: 2c 37 37 38 35 32 2c 36 36 35 31 30 38 2c 38 33  ,77852,665108,83
1090: 35 32 36 2c 2d 36 32 33 39 32 35 2c 2d 31 39 39  526,-623925,-199
10a0: 32 38 37 2c 34 39 32 34 32 37 2c 33 31 31 33 35  287,492427,31135
10b0: 37 2c 2d 34 33 37 38 38 30 2c 33 39 33 34 31 2c  7,-437880,39341,
10c0: 39 38 38 38 35 32 2c 2d 32 36 31 30 30 37 2c 2d  988852,-261007,-
10d0: 36 32 31 35 34 36 2c 2d 36 35 39 33 37 32 2c 2d  621546,-659372,-
10e0: 36 36 31 33 30 35 2c 31 39 36 33 32 39 2c 37 36  661305,196329,76
10f0: 39 31 35 39 2c 2d 37 37 31 32 35 35 2c 2d 38 38  9159,-771255,-88
1100: 38 39 33 39 2c 34 38 33 31 38 30 2c 2d 31 35 31  8939,483180,-151
1110: 31 32 37 2c 2d 35 33 33 37 33 36 2c 32 38 31 32  127,-533736,2812
1120: 39 37 2c 34 31 31 32 34 36 2c 2d 33 33 39 38 32  97,411246,-33982
1130: 35 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c  5};...  vector <
1140: 69 6e 74 3e 20 79 28 79 5f 2c 20 79 5f 2b 73 69  int> y(y_, y_+si
1150: 7a 65 6f 66 28 79 5f 29 2f 73 69 7a 65 6f 66 28  zeof(y_)/sizeof(
1160: 2a 79 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 77 61  *y_)); ...int wa
1170: 6e 74 65 64 50 61 72 69 74 79 20 3d 20 31 3b 20  ntedParity = 1; 
1180: 0d 0a 09 73 74 72 69 6e 67 20 5f 20 3d 20 22 3f  ...string _ = "?
1190: 3f 3f 22 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45  ??"; ..END..CASE
11a0: 28 36 29 0d 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d  (6)...int x_[] =
11b0: 20 7b 31 35 39 38 33 33 2c 2d 36 32 36 36 35 2c   {159833,-62665,
11c0: 33 32 33 38 38 39 2c 2d 32 33 35 38 37 39 2c 31  323889,-235879,1
11d0: 33 37 30 38 39 2c 2d 36 36 39 38 35 30 2c 31 33  37089,-669850,13
11e0: 37 35 35 34 2c 35 34 39 37 36 34 2c 31 39 31 38  7554,549764,1918
11f0: 30 37 2c 39 39 33 32 32 30 2c 2d 38 30 31 38 36  07,993220,-80186
1200: 34 2c 2d 34 32 35 39 30 32 2c 33 32 36 38 39 36  4,-425902,326896
1210: 2c 33 31 32 33 31 38 2c 2d 37 37 38 36 38 36 2c  ,312318,-778686,
1220: 33 33 30 33 30 2c 37 36 33 36 33 33 2c 2d 38 36  33030,763633,-86
1230: 36 33 34 33 2c 33 36 39 33 38 2c 2d 36 32 37 32  6343,36938,-6272
1240: 33 34 2c 2d 31 39 39 34 31 2c 2d 39 30 39 39 32  34,-19941,-90992
1250: 38 2c 2d 39 32 30 36 37 38 2c 2d 37 36 33 37 36  8,-920678,-76376
1260: 39 2c 36 35 37 37 37 33 2c 34 33 31 36 36 30 2c  9,657773,431660,
1270: 36 30 30 37 38 34 2c 35 34 39 31 32 2c 35 36 33  600784,54912,563
1280: 33 39 34 2c 39 37 30 37 34 34 2c 38 37 32 39 33  394,970744,87293
1290: 33 2c 2d 34 31 33 36 39 37 2c 33 31 39 33 37 35  3,-413697,319375
12a0: 2c 32 34 39 36 39 36 2c 33 36 38 35 35 39 2c 2d  ,249696,368559,-
12b0: 34 34 39 36 35 39 2c 39 34 32 36 35 30 2c 39 39  449659,942650,99
12c0: 37 30 30 34 2c 2d 34 32 30 30 39 36 2c 2d 34 37  7004,-420096,-47
12d0: 33 32 31 39 2c 2d 37 35 37 31 37 32 2c 37 30 39  3219,-757172,709
12e0: 33 34 2c 2d 37 37 31 33 31 30 2c 34 39 38 31 34  34,-771310,49814
12f0: 30 2c 2d 38 37 30 39 39 38 2c 31 37 36 34 32 39  0,-870998,176429
1300: 2c 39 38 35 30 36 31 2c 2d 36 37 34 30 33 33 2c  ,985061,-674033,
1310: 32 35 35 31 36 37 2c 2d 38 39 35 30 33 7d 3b 0d  255167,-89503};.
1320: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e  ..  vector <int>
1330: 20 78 28 78 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66   x(x_, x_+sizeof
1340: 28 78 5f 29 2f 73 69 7a 65 6f 66 28 2a 78 5f 29  (x_)/sizeof(*x_)
1350: 29 3b 20 0d 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d  ); ...int y_[] =
1360: 20 7b 31 35 39 38 33 33 2c 2d 36 32 36 36 35 2c   {159833,-62665,
1370: 33 32 33 38 38 39 2c 2d 32 33 35 38 37 39 2c 31  323889,-235879,1
1380: 33 37 30 38 39 2c 2d 36 36 39 38 35 30 2c 31 33  37089,-669850,13
1390: 37 35 35 34 2c 35 34 39 37 36 34 2c 31 39 31 38  7554,549764,1918
13a0: 30 37 2c 39 39 33 32 32 30 2c 2d 38 30 31 38 36  07,993220,-80186
13b0: 34 2c 2d 34 32 35 39 30 32 2c 33 32 36 38 39 36  4,-425902,326896
13c0: 2c 33 31 32 33 31 38 2c 2d 37 37 38 36 38 36 2c  ,312318,-778686,
13d0: 33 33 30 33 30 2c 37 36 33 36 33 33 2c 2d 38 36  33030,763633,-86
13e0: 36 33 34 33 2c 33 36 39 33 38 2c 2d 36 32 37 32  6343,36938,-6272
13f0: 33 34 2c 2d 31 39 39 34 31 2c 2d 39 30 39 39 32  34,-19941,-90992
1400: 38 2c 2d 39 32 30 36 37 38 2c 2d 37 36 33 37 36  8,-920678,-76376
1410: 39 2c 36 35 37 37 37 33 2c 34 33 31 36 36 30 2c  9,657773,431660,
1420: 36 30 30 37 38 34 2c 35 34 39 31 32 2c 35 36 33  600784,54912,563
1430: 33 39 34 2c 39 37 30 37 34 34 2c 38 37 32 39 33  394,970744,87293
1440: 33 2c 2d 34 31 33 36 39 37 2c 33 31 39 33 37 35  3,-413697,319375
1450: 2c 32 34 39 36 39 36 2c 33 36 38 35 35 39 2c 2d  ,249696,368559,-
1460: 34 34 39 36 35 39 2c 39 34 32 36 35 30 2c 39 39  449659,942650,99
1470: 37 30 30 34 2c 2d 34 32 30 30 39 36 2c 2d 34 37  7004,-420096,-47
1480: 33 32 31 39 2c 2d 37 35 37 31 37 32 2c 37 30 39  3219,-757172,709
1490: 33 34 2c 2d 37 37 31 33 31 30 2c 34 39 38 31 34  34,-771310,49814
14a0: 30 2c 2d 38 37 30 39 39 38 2c 31 37 36 34 32 39  0,-870998,176429
14b0: 2c 39 38 35 30 36 31 2c 2d 36 37 34 30 33 33 2c  ,985061,-674033,
14c0: 32 35 35 31 36 37 2c 2d 38 39 35 30 33 7d 3b 0d  255167,-89503};.
14d0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e  ..  vector <int>
14e0: 20 79 28 79 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66   y(y_, y_+sizeof
14f0: 28 79 5f 29 2f 73 69 7a 65 6f 66 28 2a 79 5f 29  (y_)/sizeof(*y_)
1500: 29 3b 20 0d 0a 09 69 6e 74 20 77 61 6e 74 65 64  ); ...int wanted
1510: 50 61 72 69 74 79 20 3d 20 30 3b 20 0d 0a 09 73  Parity = 0; ...s
1520: 74 72 69 6e 67 20 5f 20 3d 20 22 3f 3f 3f 22 3b  tring _ = "???";
1530: 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 36 29 0d   ..END..CASE(6).
1540: 0a 09 69 6e 74 20 78 5f 5b 5d 20 3d 20 7b 31 35  ..int x_[] = {15
1550: 39 38 33 33 2c 2d 36 32 36 36 35 2c 33 32 33 38  9833,-62665,3238
1560: 38 39 2c 2d 32 33 35 38 37 39 2c 31 33 37 30 38  89,-235879,13708
1570: 39 2c 2d 36 36 39 38 35 30 2c 31 33 37 35 35 34  9,-669850,137554
1580: 2c 35 34 39 37 36 34 2c 31 39 31 38 30 37 2c 39  ,549764,191807,9
1590: 39 33 32 32 30 2c 2d 38 30 31 38 36 34 2c 2d 34  93220,-801864,-4
15a0: 32 35 39 30 32 2c 33 32 36 38 39 36 2c 33 31 32  25902,326896,312
15b0: 33 31 38 2c 2d 37 37 38 36 38 36 2c 33 33 30 33  318,-778686,3303
15c0: 30 2c 37 36 33 36 33 33 2c 2d 38 36 36 33 34 33  0,763633,-866343
15d0: 2c 33 36 39 33 38 2c 2d 36 32 37 32 33 34 2c 2d  ,36938,-627234,-
15e0: 31 39 39 34 31 2c 2d 39 30 39 39 32 38 2c 2d 39  19941,-909928,-9
15f0: 32 30 36 37 38 2c 2d 37 36 33 37 36 39 2c 36 35  20678,-763769,65
1600: 37 37 37 33 2c 34 33 31 36 36 30 2c 36 30 30 37  7773,431660,6007
1610: 38 34 2c 35 34 39 31 32 2c 35 36 33 33 39 34 2c  84,54912,563394,
1620: 39 37 30 37 34 34 2c 38 37 32 39 33 33 2c 2d 34  970744,872933,-4
1630: 31 33 36 39 37 2c 33 31 39 33 37 35 2c 32 34 39  13697,319375,249
1640: 36 39 36 2c 33 36 38 35 35 39 2c 2d 34 34 39 36  696,368559,-4496
1650: 35 39 2c 39 34 32 36 35 30 2c 39 39 37 30 30 34  59,942650,997004
1660: 2c 2d 34 32 30 30 39 36 2c 2d 34 37 33 32 31 39  ,-420096,-473219
1670: 2c 2d 37 35 37 31 37 32 2c 37 30 39 33 34 2c 2d  ,-757172,70934,-
1680: 37 37 31 33 31 30 2c 34 39 38 31 34 30 2c 2d 38  771310,498140,-8
1690: 37 30 39 39 38 2c 31 37 36 34 32 39 2c 39 38 35  70998,176429,985
16a0: 30 36 31 2c 2d 36 37 34 30 33 33 2c 32 35 35 31  061,-674033,2551
16b0: 36 37 2c 2d 38 39 35 30 33 7d 3b 0d 0a 09 20 20  67,-89503};...  
16c0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 78 28 78  vector <int> x(x
16d0: 5f 2c 20 78 5f 2b 73 69 7a 65 6f 66 28 78 5f 29  _, x_+sizeof(x_)
16e0: 2f 73 69 7a 65 6f 66 28 2a 78 5f 29 29 3b 20 0d  /sizeof(*x_)); .
16f0: 0a 09 69 6e 74 20 79 5f 5b 5d 20 3d 20 7b 31 35  ..int y_[] = {15
1700: 39 38 33 33 2c 2d 36 32 36 36 35 2c 33 32 33 38  9833,-62665,3238
1710: 38 39 2c 2d 32 33 35 38 37 39 2c 31 33 37 30 38  89,-235879,13708
1720: 39 2c 2d 36 36 39 38 35 30 2c 31 33 37 35 35 34  9,-669850,137554
1730: 2c 35 34 39 37 36 34 2c 31 39 31 38 30 37 2c 39  ,549764,191807,9
1740: 39 33 32 32 30 2c 2d 38 30 31 38 36 34 2c 2d 34  93220,-801864,-4
1750: 32 35 39 30 32 2c 33 32 36 38 39 36 2c 33 31 32  25902,326896,312
1760: 33 31 38 2c 2d 37 37 38 36 38 36 2c 33 33 30 33  318,-778686,3303
1770: 30 2c 37 36 33 36 33 33 2c 2d 38 36 36 33 34 33  0,763633,-866343
1780: 2c 33 36 39 33 38 2c 2d 36 32 37 32 33 34 2c 2d  ,36938,-627234,-
1790: 31 39 39 34 31 2c 2d 39 30 39 39 32 38 2c 2d 39  19941,-909928,-9
17a0: 32 30 36 37 38 2c 2d 37 36 33 37 36 39 2c 36 35  20678,-763769,65
17b0: 37 37 37 33 2c 34 33 31 36 36 30 2c 36 30 30 37  7773,431660,6007
17c0: 38 34 2c 35 34 39 31 32 2c 35 36 33 33 39 34 2c  84,54912,563394,
17d0: 39 37 30 37 34 34 2c 38 37 32 39 33 33 2c 2d 34  970744,872933,-4
17e0: 31 33 36 39 37 2c 33 31 39 33 37 35 2c 32 34 39  13697,319375,249
17f0: 36 39 36 2c 33 36 38 35 35 39 2c 2d 34 34 39 36  696,368559,-4496
1800: 35 39 2c 39 34 32 36 35 30 2c 39 39 37 30 30 34  59,942650,997004
1810: 2c 2d 34 32 30 30 39 36 2c 2d 34 37 33 32 31 39  ,-420096,-473219
1820: 2c 2d 37 35 37 31 37 32 2c 37 30 39 33 34 2c 2d  ,-757172,70934,-
1830: 37 37 31 33 31 30 2c 34 39 38 31 34 30 2c 2d 38  771310,498140,-8
1840: 37 30 39 39 38 2c 31 37 36 34 32 39 2c 39 38 35  70998,176429,985
1850: 30 36 31 2c 2d 36 37 34 30 33 33 2c 32 35 35 31  061,-674033,2551
1860: 36 37 2c 2d 38 39 35 30 33 7d 3b 0d 0a 09 20 20  67,-89503};...  
1870: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 79 28 79  vector <int> y(y
1880: 5f 2c 20 79 5f 2b 73 69 7a 65 6f 66 28 79 5f 29  _, y_+sizeof(y_)
1890: 2f 73 69 7a 65 6f 66 28 2a 79 5f 29 29 3b 20 0d  /sizeof(*y_)); .
18a0: 0a 09 69 6e 74 20 77 61 6e 74 65 64 50 61 72 69  ..int wantedPari
18b0: 74 79 20 3d 20 31 3b 20 0d 0a 09 73 74 72 69 6e  ty = 1; ...strin
18c0: 67 20 5f 20 3d 20 22 3f 3f 3f 22 3b 20 0d 0a 45  g _ = "???"; ..E
18d0: 4e 44 0d 0a 0d 0a 7d 0d 0a 2f 2f 20 45 4e 44 20  ND....}..// END 
18e0: 43 55 54 20 48 45 52 45 0d 0a                    CUT HERE..