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 0d 0a 63 6c 61 73 73 20 4e 65 76 65 P;....class Neve
01a0: 72 41 73 6b 48 65 72 41 67 65 20 7b 20 70 75 62 rAskHerAge { pub
01b0: 6c 69 63 3a 0d 0a 09 76 65 63 74 6f 72 20 3c 69 lic:...vector <i
01c0: 6e 74 3e 20 70 6f 73 73 69 62 6c 65 53 6f 6c 75 nt> possibleSolu
01d0: 74 69 6f 6e 28 69 6e 74 20 6e 2c 20 76 65 63 74 tion(int n, vect
01e0: 6f 72 20 3c 69 6e 74 3e 20 69 64 31 2c 20 76 65 or <int> id1, ve
01f0: 63 74 6f 72 20 3c 69 6e 74 3e 20 69 64 32 2c 20 ctor <int> id2,
0200: 76 65 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 vector <string>
0210: 6f 70 2c 20 76 65 63 74 6f 72 20 3c 73 74 72 69 op, vector <stri
0220: 6e 67 3e 20 72 6c 2c 20 76 65 63 74 6f 72 20 3c ng> rl, vector <
0230: 69 6e 74 3e 20 76 61 6c 29 0d 0a 09 7b 0d 0a 09 int> val)...{...
0240: 09 2f 2f 20 21 21 21 42 65 69 6e 67 20 61 20 67 .// !!!Being a g
0250: 65 65 6b 2c 20 4a 69 72 6f 20 68 61 73 20 74 6f eek, Jiro has to
0260: 20 70 65 72 66 65 72 20 30 2d 6f 72 69 67 69 6e perfer 0-origin
0270: 20 6e 75 6d 62 65 72 69 6e 67 21 21 21 0d 0a 09 numbering!!!...
0280: 09 66 6f 72 28 61 75 74 6f 26 20 67 3a 20 69 64 .for(auto& g: id
0290: 31 29 20 2d 2d 67 3b 0d 0a 09 09 66 6f 72 28 61 1) --g;....for(a
02a0: 75 74 6f 26 20 67 3a 20 69 64 32 29 20 2d 2d 67 uto& g: id2) --g
02b0: 3b 0d 0a 0d 0a 09 09 66 6f 72 28 61 75 74 6f 26 ;......for(auto&
02c0: 20 73 3a 20 72 6c 29 20 7b 69 66 28 73 3d 3d 22 s: rl) {if(s=="
02d0: 3c 3d 22 29 20 73 3d 22 4c 22 3b 20 69 66 28 73 <=") s="L"; if(s
02e0: 3d 3d 22 3e 3d 22 29 20 73 3d 22 47 22 3b 7d 0d ==">=") s="G";}.
02f0: 0a 0d 0a 09 09 2f 2f 20 63 68 65 63 6b 20 6f 62 .....// check ob
0300: 76 69 6f 75 73 6c 79 20 66 61 6c 73 65 20 63 6f viously false co
0310: 6e 64 69 74 69 6f 6e 73 2e 0d 0a 09 09 66 6f 72 nditions.....for
0320: 28 69 6e 74 20 69 3d 30 3b 20 69 3c 69 64 31 2e (int i=0; i<id1.
0330: 73 69 7a 65 28 29 3b 20 2b 2b 69 29 20 69 66 28 size(); ++i) if(
0340: 72 6c 5b 69 5d 3d 3d 22 3d 22 29 20 7b 0d 0a 09 rl[i]=="=") {...
0350: 09 09 69 66 28 6f 70 5b 69 5d 3d 3d 22 2f 22 29 ..if(op[i]=="/")
0360: 20 7b 0d 0a 09 09 09 09 69 66 28 76 61 6c 5b 69 {......if(val[i
0370: 5d 3d 3d 30 29 0d 0a 09 09 09 09 09 72 65 74 75 ]==0).......retu
0380: 72 6e 20 76 65 63 74 6f 72 3c 69 6e 74 3e 28 29 rn vector<int>()
0390: 3b 0d 0a 09 09 09 09 63 6f 6e 74 69 6e 75 65 3b ;......continue;
03a0: 0d 0a 09 09 09 7d 0d 0a 09 09 09 69 66 28 76 61 .....}.....if(va
03b0: 6c 5b 69 5d 25 31 30 30 30 20 21 3d 20 30 29 0d l[i]%1000 != 0).
03c0: 0a 09 09 09 09 72 65 74 75 72 6e 20 76 65 63 74 .....return vect
03d0: 6f 72 3c 69 6e 74 3e 28 29 3b 0d 0a 09 09 09 69 or<int>();.....i
03e0: 6e 74 20 76 20 3d 20 76 61 6c 5b 69 5d 20 2f 20 nt v = val[i] /
03f0: 31 30 30 30 3b 0d 0a 09 09 09 69 66 28 6f 70 5b 1000;.....if(op[
0400: 69 5d 3d 3d 22 2b 22 20 26 26 20 28 76 3c 32 20 i]=="+" && (v<2
0410: 7c 7c 20 76 3e 32 30 30 29 29 20 72 65 74 75 72 || v>200)) retur
0420: 6e 20 76 65 63 74 6f 72 3c 69 6e 74 3e 28 29 3b n vector<int>();
0430: 0d 0a 09 09 09 69 66 28 6f 70 5b 69 5d 3d 3d 22 .....if(op[i]=="
0440: 2d 22 20 26 26 20 28 76 3c 2d 39 39 20 7c 7c 20 -" && (v<-99 ||
0450: 76 3e 39 39 29 29 20 72 65 74 75 72 6e 20 76 65 v>99)) return ve
0460: 63 74 6f 72 3c 69 6e 74 3e 28 29 3b 0d 0a 09 09 ctor<int>();....
0470: 09 69 66 28 6f 70 5b 69 5d 3d 3d 22 2a 22 29 20 .if(op[i]=="*")
0480: 7b 0d 0a 09 09 09 09 69 66 28 76 3c 31 20 7c 7c {......if(v<1 ||
0490: 20 31 30 30 30 30 3c 76 29 20 72 65 74 75 72 6e 10000<v) return
04a0: 20 76 65 63 74 6f 72 3c 69 6e 74 3e 28 29 3b 0d vector<int>();.
04b0: 0a 09 09 09 09 66 6f 72 28 69 6e 74 20 70 3d 32 .....for(int p=2
04c0: 3b 20 70 2a 70 3c 3d 76 3b 20 2b 2b 70 29 0d 0a ; p*p<=v; ++p)..
04d0: 09 09 09 09 09 77 68 69 6c 65 28 76 25 70 3d 3d .....while(v%p==
04e0: 30 29 76 2f 3d 70 3b 0d 0a 09 09 09 09 69 66 28 0)v/=p;......if(
04f0: 76 3e 31 30 30 29 20 72 65 74 75 72 6e 20 76 65 v>100) return ve
0500: 63 74 6f 72 3c 69 6e 74 3e 28 29 3b 0d 0a 09 09 ctor<int>();....
0510: 09 7d 0d 0a 09 09 7d 0d 0a 0d 0a 09 09 2f 2f 20 .}....}......//
0520: 52 65 6c 65 76 61 6e 74 20 63 6f 6e 73 74 72 61 Relevant constra
0530: 69 6e 74 73 0d 0a 09 09 76 65 63 74 6f 72 3c 73 ints....vector<s
0540: 65 74 3c 69 6e 74 3e 3e 20 72 65 6c 28 6e 29 3b et<int>> rel(n);
0550: 0d 0a 09 09 66 6f 72 28 69 6e 74 20 69 3d 30 3b ....for(int i=0;
0560: 20 69 3c 69 64 31 2e 73 69 7a 65 28 29 3b 20 2b i<id1.size(); +
0570: 2b 69 29 20 72 65 6c 5b 69 64 31 5b 69 5d 5d 2e +i) rel[id1[i]].
0580: 69 6e 73 65 72 74 28 69 29 3b 0d 0a 09 09 66 6f insert(i);....fo
0590: 72 28 69 6e 74 20 69 3d 30 3b 20 69 3c 69 64 32 r(int i=0; i<id2
05a0: 2e 73 69 7a 65 28 29 3b 20 2b 2b 69 29 20 72 65 .size(); ++i) re
05b0: 6c 5b 69 64 32 5b 69 5d 5d 2e 69 6e 73 65 72 74 l[id2[i]].insert
05c0: 28 69 29 3b 0d 0a 0d 0a 09 09 2f 2f 20 54 72 79 (i);......// Try
05d0: 20 68 69 67 68 6c 79 20 63 6f 6e 73 74 72 61 69 highly constrai
05e0: 6e 65 64 20 67 69 72 6c 20 66 69 72 73 74 2e 0d ned girl first..
05f0: 0a 09 09 76 65 63 74 6f 72 3c 69 6e 74 3e 20 67 ...vector<int> g
0600: 69 72 6c 73 3b 20 66 6f 72 28 69 6e 74 20 67 3d irls; for(int g=
0610: 30 3b 20 67 3c 6e 3b 20 2b 2b 67 29 20 67 69 72 0; g<n; ++g) gir
0620: 6c 73 2e 70 75 73 68 5f 62 61 63 6b 28 67 29 3b ls.push_back(g);
0630: 0d 0a 09 09 73 6f 72 74 28 67 69 72 6c 73 2e 62 ....sort(girls.b
0640: 65 67 69 6e 28 29 2c 20 67 69 72 6c 73 2e 65 6e egin(), girls.en
0650: 64 28 29 2c 20 5b 26 5d 28 69 6e 74 20 67 31 2c d(), [&](int g1,
0660: 20 69 6e 74 20 67 32 29 7b 72 65 74 75 72 6e 20 int g2){return
0670: 72 65 6c 5b 67 31 5d 2e 73 69 7a 65 28 29 3e 72 rel[g1].size()>r
0680: 65 6c 5b 67 32 5d 2e 73 69 7a 65 28 29 3b 7d 29 el[g2].size();})
0690: 3b 0d 0a 0d 0a 09 09 63 6f 6e 73 74 20 69 6e 74 ;......const int
06a0: 20 55 4e 44 45 54 45 52 4d 49 4e 45 44 20 3d 20 UNDETERMINED =
06b0: 30 3b 0d 0a 09 09 76 65 63 74 6f 72 3c 69 6e 74 0;....vector<int
06c0: 3e 20 78 28 6e 2c 20 55 4e 44 45 54 45 52 4d 49 > x(n, UNDETERMI
06d0: 4e 45 44 29 3b 0d 0a 09 09 66 75 6e 63 74 69 6f NED);....functio
06e0: 6e 3c 62 6f 6f 6c 28 69 6e 74 29 3e 20 72 65 63 n<bool(int)> rec
06f0: 3b 0d 0a 09 09 72 65 63 20 3d 20 5b 26 5d 28 69 ;....rec = [&](i
0700: 6e 74 20 67 69 29 7b 0d 0a 09 09 09 69 66 28 67 nt gi){.....if(g
0710: 69 20 3d 3d 20 6e 29 0d 0a 09 09 09 09 72 65 74 i == n)......ret
0720: 75 72 6e 20 74 72 75 65 3b 0d 0a 09 09 09 69 6e urn true;.....in
0730: 74 20 67 20 3d 20 67 69 72 6c 73 5b 67 69 5d 3b t g = girls[gi];
0740: 0d 0a 09 09 09 66 6f 72 28 69 6e 74 20 61 67 65 .....for(int age
0750: 3d 31 3b 20 61 67 65 3c 3d 31 30 30 3b 20 2b 2b =1; age<=100; ++
0760: 61 67 65 29 0d 0a 09 09 09 7b 0d 0a 09 09 09 09 age).....{......
0770: 78 5b 67 5d 20 3d 20 61 67 65 3b 0d 0a 09 09 09 x[g] = age;.....
0780: 09 62 6f 6f 6c 20 62 61 64 20 3d 20 66 61 6c 73 .bool bad = fals
0790: 65 3b 0d 0a 09 09 09 09 66 6f 72 28 69 6e 74 20 e;......for(int
07a0: 69 3a 20 72 65 6c 5b 67 5d 29 20 69 66 28 78 5b i: rel[g]) if(x[
07b0: 69 64 31 5b 69 5d 5d 21 3d 55 4e 44 45 54 45 52 id1[i]]!=UNDETER
07c0: 4d 49 4e 45 44 20 26 26 20 78 5b 69 64 32 5b 69 MINED && x[id2[i
07d0: 5d 5d 21 3d 55 4e 44 45 54 45 52 4d 49 4e 45 44 ]]!=UNDETERMINED
07e0: 29 20 7b 0d 0a 09 09 09 09 09 69 66 28 21 6f 6b ) {.......if(!ok
07f0: 28 78 5b 69 64 31 5b 69 5d 5d 2c 20 6f 70 5b 69 (x[id1[i]], op[i
0800: 5d 5b 30 5d 2c 20 78 5b 69 64 32 5b 69 5d 5d 2c ][0], x[id2[i]],
0810: 20 72 6c 5b 69 5d 5b 30 5d 2c 20 76 61 6c 5b 69 rl[i][0], val[i
0820: 5d 29 29 0d 0a 09 09 09 09 09 09 7b 62 61 64 3d ]))........{bad=
0830: 74 72 75 65 3b 20 62 72 65 61 6b 3b 7d 0d 0a 09 true; break;}...
0840: 09 09 09 7d 20 65 6c 73 65 20 7b 0d 0a 09 09 09 ...} else {.....
0850: 09 09 69 66 28 21 6f 6b 5f 70 61 72 74 28 78 5b ..if(!ok_part(x[
0860: 69 64 31 5b 69 5d 5d 2c 20 6f 70 5b 69 5d 5b 30 id1[i]], op[i][0
0870: 5d 2c 20 78 5b 69 64 32 5b 69 5d 5d 2c 20 72 6c ], x[id2[i]], rl
0880: 5b 69 5d 5b 30 5d 2c 20 76 61 6c 5b 69 5d 29 29 [i][0], val[i]))
0890: 0d 0a 09 09 09 09 09 09 7b 62 61 64 3d 74 72 75 ........{bad=tru
08a0: 65 3b 20 62 72 65 61 6b 3b 7d 0d 0a 09 09 09 09 e; break;}......
08b0: 7d 0d 0a 09 09 09 09 69 66 28 21 62 61 64 20 26 }......if(!bad &
08c0: 26 20 72 65 63 28 67 69 2b 31 29 29 0d 0a 09 09 & rec(gi+1))....
08d0: 09 09 09 72 65 74 75 72 6e 20 74 72 75 65 3b 0d ...return true;.
08e0: 0a 09 09 09 09 78 5b 67 5d 20 3d 20 55 4e 44 45 .....x[g] = UNDE
08f0: 54 45 52 4d 49 4e 45 44 3b 0d 0a 09 09 09 7d 0d TERMINED;.....}.
0900: 0a 09 09 09 72 65 74 75 72 6e 20 66 61 6c 73 65 ....return false
0910: 3b 0d 0a 09 09 7d 3b 0d 0a 09 09 69 66 28 21 72 ;....};....if(!r
0920: 65 63 28 30 29 29 20 72 65 74 75 72 6e 20 76 65 ec(0)) return ve
0930: 63 74 6f 72 3c 69 6e 74 3e 28 29 3b 0d 0a 09 09 ctor<int>();....
0940: 72 65 74 75 72 6e 20 78 3b 0d 0a 09 7d 0d 0a 0d return x;...}...
0950: 0a 09 73 74 61 74 69 63 20 62 6f 6f 6c 20 6f 6b ..static bool ok
0960: 28 69 6e 74 20 78 31 2c 20 63 68 61 72 20 6f 70 (int x1, char op
0970: 2c 20 69 6e 74 20 78 32 2c 20 63 68 61 72 20 72 , int x2, char r
0980: 6c 2c 20 69 6e 74 20 76 61 6c 29 0d 0a 09 7b 0d l, int val)...{.
0990: 0a 09 09 73 77 69 74 63 68 28 6f 70 29 20 7b 0d ...switch(op) {.
09a0: 0a 09 09 63 61 73 65 20 27 2b 27 3a 20 72 65 74 ...case '+': ret
09b0: 75 72 6e 20 6f 6b 28 28 78 31 2b 78 32 29 2a 31 urn ok((x1+x2)*1
09c0: 30 30 30 2c 20 72 6c 2c 20 76 61 6c 29 3b 0d 0a 000, rl, val);..
09d0: 09 09 63 61 73 65 20 27 2d 27 3a 20 72 65 74 75 ..case '-': retu
09e0: 72 6e 20 6f 6b 28 28 78 31 2d 78 32 29 2a 31 30 rn ok((x1-x2)*10
09f0: 30 30 2c 20 72 6c 2c 20 76 61 6c 29 3b 0d 0a 09 00, rl, val);...
0a00: 09 63 61 73 65 20 27 2a 27 3a 20 72 65 74 75 72 .case '*': retur
0a10: 6e 20 6f 6b 28 28 78 31 2a 78 32 29 2a 31 30 30 n ok((x1*x2)*100
0a20: 30 2c 20 72 6c 2c 20 76 61 6c 29 3b 0d 0a 09 09 0, rl, val);....
0a30: 63 61 73 65 20 27 2f 27 3a 20 72 65 74 75 72 6e case '/': return
0a40: 20 6f 6b 28 28 78 31 29 2a 31 30 30 30 2c 20 72 ok((x1)*1000, r
0a50: 6c 2c 20 76 61 6c 2a 78 32 29 3b 0d 0a 09 09 7d l, val*x2);....}
0a60: 0d 0a 09 09 72 65 74 75 72 6e 20 66 61 6c 73 65 ....return false
0a70: 3b 0d 0a 09 7d 0d 0a 09 73 74 61 74 69 63 20 62 ;...}...static b
0a80: 6f 6f 6c 20 6f 6b 28 69 6e 74 20 78 2c 20 63 68 ool ok(int x, ch
0a90: 61 72 20 72 65 6c 2c 20 69 6e 74 20 79 29 0d 0a ar rel, int y)..
0aa0: 09 7b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 3c .{....if(rel=='<
0ab0: 27 29 20 72 65 74 75 72 6e 20 78 20 3c 20 79 3b ') return x < y;
0ac0: 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 4c 27 29 ....if(rel=='L')
0ad0: 20 72 65 74 75 72 6e 20 78 20 3c 3d 20 79 3b 0d return x <= y;.
0ae0: 0a 09 09 69 66 28 72 65 6c 3d 3d 27 3e 27 29 20 ...if(rel=='>')
0af0: 72 65 74 75 72 6e 20 78 20 3e 20 79 3b 0d 0a 09 return x > y;...
0b00: 09 69 66 28 72 65 6c 3d 3d 27 47 27 29 20 72 65 .if(rel=='G') re
0b10: 74 75 72 6e 20 78 20 3e 3d 20 79 3b 0d 0a 09 09 turn x >= y;....
0b20: 69 66 28 72 65 6c 3d 3d 27 3d 27 29 20 72 65 74 if(rel=='=') ret
0b30: 75 72 6e 20 78 20 3d 3d 20 79 3b 0d 0a 09 09 72 urn x == y;....r
0b40: 65 74 75 72 6e 20 66 61 6c 73 65 3b 0d 0a 09 7d eturn false;...}
0b50: 0d 0a 09 73 74 61 74 69 63 20 62 6f 6f 6c 20 6f ...static bool o
0b60: 6b 5f 70 61 72 74 28 69 6e 74 20 78 31 2c 20 63 k_part(int x1, c
0b70: 68 61 72 20 6f 70 2c 20 69 6e 74 20 78 32 2c 20 har op, int x2,
0b80: 63 68 61 72 20 72 6c 2c 20 69 6e 74 20 76 61 6c char rl, int val
0b90: 29 0d 0a 09 7b 0d 0a 09 09 73 77 69 74 63 68 28 )...{....switch(
0ba0: 6f 70 29 20 7b 0d 0a 09 09 63 61 73 65 20 27 2b op) {....case '+
0bb0: 27 3a 20 72 65 74 75 72 6e 20 6f 6b 5f 70 61 72 ': return ok_par
0bc0: 74 5f 70 6c 75 73 28 6d 61 78 28 78 31 2c 78 32 t_plus(max(x1,x2
0bd0: 29 2c 20 72 6c 2c 20 76 61 6c 29 3b 0d 0a 09 09 ), rl, val);....
0be0: 63 61 73 65 20 27 2d 27 3a 20 72 65 74 75 72 6e case '-': return
0bf0: 20 78 31 20 3f 20 6f 6b 5f 70 61 72 74 5f 6d 69 x1 ? ok_part_mi
0c00: 6e 75 73 6c 28 78 31 2c 20 72 6c 2c 20 76 61 6c nusl(x1, rl, val
0c10: 29 0d 0a 09 09 09 09 09 20 20 20 20 20 20 20 20 ).......
0c20: 3a 20 6f 6b 5f 70 61 72 74 5f 6d 69 6e 75 73 72 : ok_part_minusr
0c30: 28 78 32 2c 20 72 6c 2c 20 76 61 6c 29 3b 0d 0a (x2, rl, val);..
0c40: 09 09 63 61 73 65 20 27 2a 27 3a 20 72 65 74 75 ..case '*': retu
0c50: 72 6e 20 6f 6b 5f 70 61 72 74 5f 6d 75 6c 74 28 rn ok_part_mult(
0c60: 6d 61 78 28 78 31 2c 78 32 29 2c 20 72 6c 2c 20 max(x1,x2), rl,
0c70: 76 61 6c 29 3b 0d 0a 09 09 63 61 73 65 20 27 2f val);....case '/
0c80: 27 3a 20 72 65 74 75 72 6e 20 78 31 20 3f 20 6f ': return x1 ? o
0c90: 6b 5f 70 61 72 74 5f 64 69 76 6c 28 78 31 2c 20 k_part_divl(x1,
0ca0: 72 6c 2c 20 76 61 6c 29 0d 0a 09 09 09 09 09 20 rl, val).......
0cb0: 20 20 20 20 20 20 20 3a 20 6f 6b 5f 70 61 72 74 : ok_part
0cc0: 5f 64 69 76 72 28 78 32 2c 20 72 6c 2c 20 76 61 _divr(x2, rl, va
0cd0: 6c 29 3b 0d 0a 09 09 7d 0d 0a 09 09 72 65 74 75 l);....}....retu
0ce0: 72 6e 20 74 72 75 65 3b 0d 0a 09 7d 0d 0a 09 2f rn true;...}.../
0cf0: 2f 20 28 78 20 2b 20 3f 29 2a 31 30 30 30 20 72 / (x + ?)*1000 r
0d00: 65 6c 20 79 0d 0a 09 73 74 61 74 69 63 20 62 6f el y...static bo
0d10: 6f 6c 20 6f 6b 5f 70 61 72 74 5f 70 6c 75 73 28 ol ok_part_plus(
0d20: 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 6c 2c int x, char rel,
0d30: 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 09 69 int y)...{....i
0d40: 66 28 72 65 6c 3d 3d 27 3c 27 29 20 72 65 74 75 f(rel=='<') retu
0d50: 72 6e 20 28 78 2b 31 29 2a 31 30 30 30 20 3c 20 rn (x+1)*1000 <
0d60: 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 4c y;....if(rel=='L
0d70: 27 29 20 72 65 74 75 72 6e 20 28 78 2b 31 29 2a ') return (x+1)*
0d80: 31 30 30 30 20 3c 3d 20 79 3b 0d 0a 09 09 69 66 1000 <= y;....if
0d90: 28 72 65 6c 3d 3d 27 3e 27 29 20 72 65 74 75 72 (rel=='>') retur
0da0: 6e 20 28 78 2b 31 30 30 29 2a 31 30 30 30 20 3e n (x+100)*1000 >
0db0: 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 y;....if(rel=='
0dc0: 47 27 29 20 72 65 74 75 72 6e 20 28 78 2b 31 30 G') return (x+10
0dd0: 30 29 2a 31 30 30 30 20 3e 3d 20 79 3b 0d 0a 09 0)*1000 >= y;...
0de0: 09 69 66 28 72 65 6c 3d 3d 27 3d 27 29 20 72 65 .if(rel=='=') re
0df0: 74 75 72 6e 20 28 78 2b 31 29 2a 31 30 30 30 3c turn (x+1)*1000<
0e00: 3d 79 20 26 26 20 79 3c 3d 28 78 2b 31 30 30 29 =y && y<=(x+100)
0e10: 2a 31 30 30 30 3b 0d 0a 09 09 72 65 74 75 72 6e *1000;....return
0e20: 20 66 61 6c 73 65 3b 0d 0a 09 7d 0d 0a 09 2f 2f false;...}...//
0e30: 20 28 78 20 2d 20 3f 29 2a 31 30 30 30 20 72 65 (x - ?)*1000 re
0e40: 6c 20 79 0d 0a 09 73 74 61 74 69 63 20 62 6f 6f l y...static boo
0e50: 6c 20 6f 6b 5f 70 61 72 74 5f 6d 69 6e 75 73 6c l ok_part_minusl
0e60: 28 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 6c (int x, char rel
0e70: 2c 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 09 , int y)...{....
0e80: 69 66 28 72 65 6c 3d 3d 27 3c 27 29 20 72 65 74 if(rel=='<') ret
0e90: 75 72 6e 20 28 78 2d 31 30 30 29 2a 31 30 30 30 urn (x-100)*1000
0ea0: 20 3c 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d < y;....if(rel=
0eb0: 3d 27 4c 27 29 20 72 65 74 75 72 6e 20 28 78 2d ='L') return (x-
0ec0: 31 30 30 29 2a 31 30 30 30 20 3c 3d 20 79 3b 0d 100)*1000 <= y;.
0ed0: 0a 09 09 69 66 28 72 65 6c 3d 3d 27 3e 27 29 20 ...if(rel=='>')
0ee0: 72 65 74 75 72 6e 20 28 78 2d 31 29 2a 31 30 30 return (x-1)*100
0ef0: 30 20 3e 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 0 > y;....if(rel
0f00: 3d 3d 27 47 27 29 20 72 65 74 75 72 6e 20 28 78 =='G') return (x
0f10: 2d 31 29 2a 31 30 30 30 20 3e 3d 20 79 3b 0d 0a -1)*1000 >= y;..
0f20: 09 09 69 66 28 72 65 6c 3d 3d 27 3d 27 29 20 72 ..if(rel=='=') r
0f30: 65 74 75 72 6e 20 28 78 2d 31 30 30 29 2a 31 30 eturn (x-100)*10
0f40: 30 30 3c 3d 79 20 26 26 20 79 3c 3d 28 78 2d 31 00<=y && y<=(x-1
0f50: 29 2a 31 30 30 30 3b 0d 0a 09 09 72 65 74 75 72 )*1000;....retur
0f60: 6e 20 66 61 6c 73 65 3b 0d 0a 09 7d 0d 0a 09 2f n false;...}.../
0f70: 2f 20 28 3f 20 2d 20 78 29 2a 31 30 30 30 20 72 / (? - x)*1000 r
0f80: 65 6c 20 79 0d 0a 09 73 74 61 74 69 63 20 62 6f el y...static bo
0f90: 6f 6c 20 6f 6b 5f 70 61 72 74 5f 6d 69 6e 75 73 ol ok_part_minus
0fa0: 72 28 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 r(int x, char re
0fb0: 6c 2c 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 l, int y)...{...
0fc0: 09 69 66 28 72 65 6c 3d 3d 27 3c 27 29 20 72 65 .if(rel=='<') re
0fd0: 74 75 72 6e 20 28 31 2d 78 29 2a 31 30 30 30 20 turn (1-x)*1000
0fe0: 3c 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d < y;....if(rel==
0ff0: 27 4c 27 29 20 72 65 74 75 72 6e 20 28 31 2d 78 'L') return (1-x
1000: 29 2a 31 30 30 30 20 3c 3d 20 79 3b 0d 0a 09 09 )*1000 <= y;....
1010: 69 66 28 72 65 6c 3d 3d 27 3e 27 29 20 72 65 74 if(rel=='>') ret
1020: 75 72 6e 20 28 31 30 30 2d 78 29 2a 31 30 30 30 urn (100-x)*1000
1030: 20 3e 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d > y;....if(rel=
1040: 3d 27 47 27 29 20 72 65 74 75 72 6e 20 28 31 30 ='G') return (10
1050: 30 2d 78 29 2a 31 30 30 30 20 3e 3d 20 79 3b 0d 0-x)*1000 >= y;.
1060: 0a 09 09 69 66 28 72 65 6c 3d 3d 27 3d 27 29 20 ...if(rel=='=')
1070: 72 65 74 75 72 6e 20 28 31 2d 78 29 2a 31 30 30 return (1-x)*100
1080: 30 3c 3d 79 20 26 26 20 79 3c 3d 28 31 30 30 2d 0<=y && y<=(100-
1090: 78 29 2a 31 30 30 30 3b 0d 0a 09 09 72 65 74 75 x)*1000;....retu
10a0: 72 6e 20 66 61 6c 73 65 3b 0d 0a 09 7d 0d 0a 09 rn false;...}...
10b0: 2f 2f 20 28 78 20 2a 20 3f 29 2a 31 30 30 30 20 // (x * ?)*1000
10c0: 72 65 6c 20 79 0d 0a 09 73 74 61 74 69 63 20 62 rel y...static b
10d0: 6f 6f 6c 20 6f 6b 5f 70 61 72 74 5f 6d 75 6c 74 ool ok_part_mult
10e0: 28 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 6c (int x, char rel
10f0: 2c 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 09 , int y)...{....
1100: 69 66 28 72 65 6c 3d 3d 27 3c 27 29 20 72 65 74 if(rel=='<') ret
1110: 75 72 6e 20 28 78 2a 31 29 2a 31 30 30 30 20 3c urn (x*1)*1000 <
1120: 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 y;....if(rel=='
1130: 4c 27 29 20 72 65 74 75 72 6e 20 28 78 2a 31 29 L') return (x*1)
1140: 2a 31 30 30 30 20 3c 3d 20 79 3b 0d 0a 09 09 69 *1000 <= y;....i
1150: 66 28 72 65 6c 3d 3d 27 3e 27 29 20 72 65 74 75 f(rel=='>') retu
1160: 72 6e 20 28 78 2a 31 30 30 29 2a 31 30 30 30 20 rn (x*100)*1000
1170: 3e 20 79 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d > y;....if(rel==
1180: 27 47 27 29 20 72 65 74 75 72 6e 20 28 78 2a 31 'G') return (x*1
1190: 30 30 29 2a 31 30 30 30 20 3e 3d 20 79 3b 0d 0a 00)*1000 >= y;..
11a0: 09 09 69 66 28 72 65 6c 3d 3d 27 3d 27 29 20 72 ..if(rel=='=') r
11b0: 65 74 75 72 6e 20 28 78 2a 31 29 2a 31 30 30 30 eturn (x*1)*1000
11c0: 3c 3d 79 20 26 26 20 79 3c 3d 28 78 2a 31 30 30 <=y && y<=(x*100
11d0: 29 2a 31 30 30 30 20 26 26 20 79 25 28 78 2a 31 )*1000 && y%(x*1
11e0: 30 30 30 29 3d 3d 30 3b 0d 0a 09 09 72 65 74 75 000)==0;....retu
11f0: 72 6e 20 66 61 6c 73 65 3b 0d 0a 09 7d 0d 0a 09 rn false;...}...
1200: 2f 2f 20 28 78 20 2f 20 3f 29 2a 31 30 30 30 20 // (x / ?)*1000
1210: 72 65 6c 20 79 0d 0a 09 73 74 61 74 69 63 20 62 rel y...static b
1220: 6f 6f 6c 20 6f 6b 5f 70 61 72 74 5f 64 69 76 6c ool ok_part_divl
1230: 28 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 6c (int x, char rel
1240: 2c 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 09 , int y)...{....
1250: 69 66 28 72 65 6c 3d 3d 27 3c 27 29 20 72 65 74 if(rel=='<') ret
1260: 75 72 6e 20 78 2a 31 30 30 30 20 3c 20 79 2a 31 urn x*1000 < y*1
1270: 30 30 3b 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 00;....if(rel=='
1280: 4c 27 29 20 72 65 74 75 72 6e 20 78 2a 31 30 30 L') return x*100
1290: 30 20 3c 3d 20 79 2a 31 30 30 3b 0d 0a 09 09 69 0 <= y*100;....i
12a0: 66 28 72 65 6c 3d 3d 27 3e 27 29 20 72 65 74 75 f(rel=='>') retu
12b0: 72 6e 20 78 2a 31 30 30 30 20 3e 20 79 2a 31 3b rn x*1000 > y*1;
12c0: 0d 0a 09 09 69 66 28 72 65 6c 3d 3d 27 47 27 29 ....if(rel=='G')
12d0: 20 72 65 74 75 72 6e 20 78 2a 31 30 30 30 20 3e return x*1000 >
12e0: 3d 20 79 2a 31 3b 0d 0a 09 09 69 66 28 72 65 6c = y*1;....if(rel
12f0: 3d 3d 27 3d 27 29 20 72 65 74 75 72 6e 20 78 2a =='=') return x*
1300: 31 30 30 30 20 3c 3d 20 79 2a 31 30 30 20 26 26 1000 <= y*100 &&
1310: 20 78 2a 31 30 30 30 20 3e 3d 20 79 2a 31 20 26 x*1000 >= y*1 &
1320: 26 20 28 78 2a 31 30 30 30 25 79 3d 3d 30 29 3b & (x*1000%y==0);
1330: 0d 0a 09 09 72 65 74 75 72 6e 20 66 61 6c 73 65 ....return false
1340: 3b 0d 0a 09 7d 0d 0a 09 73 74 61 74 69 63 20 62 ;...}...static b
1350: 6f 6f 6c 20 6f 6b 5f 70 61 72 74 5f 64 69 76 72 ool ok_part_divr
1360: 28 69 6e 74 20 78 2c 20 63 68 61 72 20 72 65 6c (int x, char rel
1370: 2c 20 69 6e 74 20 79 29 0d 0a 09 7b 0d 0a 09 09 , int y)...{....
1380: 72 65 74 75 72 6e 20 74 72 75 65 3b 0d 0a 09 7d return true;...}
1390: 0d 0a 7d 3b 0d 0a 0d 0a 2f 2f 20 42 45 47 49 4e ..};....// BEGIN
13a0: 20 43 55 54 20 48 45 52 45 0d 0a 23 69 6e 63 6c CUT HERE..#incl
13b0: 75 64 65 20 3c 63 74 69 6d 65 3e 0d 0a 64 6f 75 ude <ctime>..dou
13c0: 62 6c 65 20 73 74 61 72 74 5f 74 69 6d 65 3b 20 ble start_time;
13d0: 73 74 72 69 6e 67 20 74 69 6d 65 72 28 29 0d 0a string timer()..
13e0: 20 7b 20 6f 73 74 72 69 6e 67 73 74 72 65 61 6d { ostringstream
13f0: 20 6f 73 3b 20 6f 73 20 3c 3c 20 22 20 28 22 20 os; os << " ("
1400: 3c 3c 20 69 6e 74 28 28 63 6c 6f 63 6b 28 29 2d << int((clock()-
1410: 73 74 61 72 74 5f 74 69 6d 65 29 2f 43 4c 4f 43 start_time)/CLOC
1420: 4b 53 5f 50 45 52 5f 53 45 43 2a 31 30 30 30 29 KS_PER_SEC*1000)
1430: 20 3c 3c 20 22 20 6d 73 65 63 29 22 3b 20 72 65 << " msec)"; re
1440: 74 75 72 6e 20 6f 73 2e 73 74 72 28 29 3b 20 7d turn os.str(); }
1450: 0d 0a 74 65 6d 70 6c 61 74 65 3c 74 79 70 65 6e ..template<typen
1460: 61 6d 65 20 54 3e 20 6f 73 74 72 65 61 6d 26 20 ame T> ostream&
1470: 6f 70 65 72 61 74 6f 72 3c 3c 28 6f 73 74 72 65 operator<<(ostre
1480: 61 6d 26 20 6f 73 2c 20 63 6f 6e 73 74 20 76 65 am& os, const ve
1490: 63 74 6f 72 3c 54 3e 26 20 76 29 0d 0a 20 7b 20 ctor<T>& v).. {
14a0: 6f 73 20 3c 3c 20 22 7b 20 22 3b 0d 0a 20 20 20 os << "{ ";..
14b0: 66 6f 72 28 74 79 70 65 6e 61 6d 65 20 76 65 63 for(typename vec
14c0: 74 6f 72 3c 54 3e 3a 3a 63 6f 6e 73 74 5f 69 74 tor<T>::const_it
14d0: 65 72 61 74 6f 72 20 69 74 3d 76 2e 62 65 67 69 erator it=v.begi
14e0: 6e 28 29 3b 20 69 74 21 3d 76 2e 65 6e 64 28 29 n(); it!=v.end()
14f0: 3b 20 2b 2b 69 74 29 0d 0a 20 20 20 6f 73 20 3c ; ++it).. os <
1500: 3c 20 27 5c 22 27 20 3c 3c 20 2a 69 74 20 3c 3c < '\"' << *it <<
1510: 20 27 5c 22 27 20 3c 3c 20 28 69 74 2b 31 3d 3d '\"' << (it+1==
1520: 76 2e 65 6e 64 28 29 20 3f 20 22 22 20 3a 20 22 v.end() ? "" : "
1530: 2c 20 22 29 3b 20 6f 73 20 3c 3c 20 22 20 7d 22 , "); os << " }"
1540: 3b 20 72 65 74 75 72 6e 20 6f 73 3b 20 7d 0d 0a ; return os; }..
1550: 76 6f 69 64 20 76 65 72 69 66 79 5f 63 61 73 65 void verify_case
1560: 28 63 6f 6e 73 74 20 76 65 63 74 6f 72 20 3c 69 (const vector <i
1570: 6e 74 3e 26 20 45 78 70 65 63 74 65 64 2c 20 63 nt>& Expected, c
1580: 6f 6e 73 74 20 76 65 63 74 6f 72 20 3c 69 6e 74 onst vector <int
1590: 3e 26 20 52 65 63 65 69 76 65 64 29 20 7b 0d 0a >& Received) {..
15a0: 20 62 6f 6f 6c 20 6f 6b 20 3d 20 28 45 78 70 65 bool ok = (Expe
15b0: 63 74 65 64 20 3d 3d 20 52 65 63 65 69 76 65 64 cted == Received
15c0: 29 3b 0d 0a 20 69 66 28 6f 6b 29 20 63 65 72 72 );.. if(ok) cerr
15d0: 20 3c 3c 20 22 50 41 53 53 45 44 22 20 3c 3c 20 << "PASSED" <<
15e0: 74 69 6d 65 72 28 29 20 3c 3c 20 65 6e 64 6c 3b timer() << endl;
15f0: 20 20 65 6c 73 65 20 7b 20 63 65 72 72 20 3c 3c else { cerr <<
1600: 20 22 46 41 49 4c 45 44 22 20 3c 3c 20 74 69 6d "FAILED" << tim
1610: 65 72 28 29 20 3c 3c 20 65 6e 64 6c 3b 0d 0a 20 er() << endl;..
1620: 63 65 72 72 20 3c 3c 20 22 5c 74 6f 3a 20 22 20 cerr << "\to: "
1630: 3c 3c 20 45 78 70 65 63 74 65 64 20 3c 3c 20 65 << Expected << e
1640: 6e 64 6c 20 3c 3c 20 22 5c 74 78 3a 20 22 20 3c ndl << "\tx: " <
1650: 3c 20 52 65 63 65 69 76 65 64 20 3c 3c 20 65 6e < Received << en
1660: 64 6c 3b 20 7d 20 7d 0d 0a 23 64 65 66 69 6e 65 dl; } }..#define
1670: 20 43 41 53 45 28 4e 29 20 7b 63 65 72 72 20 3c CASE(N) {cerr <
1680: 3c 20 22 54 65 73 74 20 43 61 73 65 20 23 22 20 < "Test Case #"
1690: 3c 3c 20 4e 20 3c 3c 20 22 2e 2e 2e 22 20 3c 3c << N << "..." <<
16a0: 20 66 6c 75 73 68 3b 20 73 74 61 72 74 5f 74 69 flush; start_ti
16b0: 6d 65 3d 63 6c 6f 63 6b 28 29 3b 0d 0a 23 64 65 me=clock();..#de
16c0: 66 69 6e 65 20 45 4e 44 09 20 76 65 72 69 66 79 fine END. verify
16d0: 5f 63 61 73 65 28 5f 2c 20 4e 65 76 65 72 41 73 _case(_, NeverAs
16e0: 6b 48 65 72 41 67 65 28 29 2e 70 6f 73 73 69 62 kHerAge().possib
16f0: 6c 65 53 6f 6c 75 74 69 6f 6e 28 6e 2c 20 69 64 leSolution(n, id
1700: 31 2c 20 69 64 32 2c 20 6f 70 2c 20 72 6c 2c 20 1, id2, op, rl,
1710: 76 61 6c 29 29 3b 7d 0d 0a 69 6e 74 20 6d 61 69 val));}..int mai
1720: 6e 28 29 7b 0d 0a 0d 0a 43 41 53 45 28 30 29 0d n(){....CASE(0).
1730: 0a 09 69 6e 74 20 6e 20 3d 20 32 3b 20 0d 0a 09 ..int n = 2; ...
1740: 69 6e 74 20 69 64 31 5f 5b 5d 20 3d 20 7b 31 2c int id1_[] = {1,
1750: 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 1};... vector <
1760: 69 6e 74 3e 20 69 64 31 28 69 64 31 5f 2c 20 69 int> id1(id1_, i
1770: 64 31 5f 2b 73 69 7a 65 6f 66 28 69 64 31 5f 29 d1_+sizeof(id1_)
1780: 2f 73 69 7a 65 6f 66 28 2a 69 64 31 5f 29 29 3b /sizeof(*id1_));
1790: 20 0d 0a 09 69 6e 74 20 69 64 32 5f 5b 5d 20 3d ...int id2_[] =
17a0: 20 7b 32 2c 32 7d 3b 0d 0a 09 20 20 76 65 63 74 {2,2};... vect
17b0: 6f 72 20 3c 69 6e 74 3e 20 69 64 32 28 69 64 32 or <int> id2(id2
17c0: 5f 2c 20 69 64 32 5f 2b 73 69 7a 65 6f 66 28 69 _, id2_+sizeof(i
17d0: 64 32 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 64 32 d2_)/sizeof(*id2
17e0: 5f 29 29 3b 20 0d 0a 09 73 74 72 69 6e 67 20 6f _)); ...string o
17f0: 70 5f 5b 5d 20 3d 20 7b 22 2b 22 2c 22 2a 22 7d p_[] = {"+","*"}
1800: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 73 74 ;... vector <st
1810: 72 69 6e 67 3e 20 6f 70 28 6f 70 5f 2c 20 6f 70 ring> op(op_, op
1820: 5f 2b 73 69 7a 65 6f 66 28 6f 70 5f 29 2f 73 69 _+sizeof(op_)/si
1830: 7a 65 6f 66 28 2a 6f 70 5f 29 29 3b 20 0d 0a 09 zeof(*op_)); ...
1840: 73 74 72 69 6e 67 20 72 6c 5f 5b 5d 20 3d 20 7b string rl_[] = {
1850: 22 3d 22 2c 22 3d 22 7d 3b 0d 0a 09 20 20 76 65 "=","="};... ve
1860: 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 72 6c ctor <string> rl
1870: 28 72 6c 5f 2c 20 72 6c 5f 2b 73 69 7a 65 6f 66 (rl_, rl_+sizeof
1880: 28 72 6c 5f 29 2f 73 69 7a 65 6f 66 28 2a 72 6c (rl_)/sizeof(*rl
1890: 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 76 61 6c 5f _)); ...int val_
18a0: 5b 5d 20 3d 20 7b 31 30 30 30 30 2c 32 31 30 30 [] = {10000,2100
18b0: 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 0};... vector <
18c0: 69 6e 74 3e 20 76 61 6c 28 76 61 6c 5f 2c 20 76 int> val(val_, v
18d0: 61 6c 5f 2b 73 69 7a 65 6f 66 28 76 61 6c 5f 29 al_+sizeof(val_)
18e0: 2f 73 69 7a 65 6f 66 28 2a 76 61 6c 5f 29 29 3b /sizeof(*val_));
18f0: 20 0d 0a 09 69 6e 74 20 5f 5f 5b 5d 20 3d 20 7b ...int __[] = {
1900: 33 2c 20 37 20 7d 3b 0d 0a 09 20 20 76 65 63 74 3, 7 };... vect
1910: 6f 72 20 3c 69 6e 74 3e 20 5f 28 5f 5f 2c 20 5f or <int> _(__, _
1920: 5f 2b 73 69 7a 65 6f 66 28 5f 5f 29 2f 73 69 7a _+sizeof(__)/siz
1930: 65 6f 66 28 2a 5f 5f 29 29 3b 20 0d 0a 45 4e 44 eof(*__)); ..END
1940: 0d 0a 43 41 53 45 28 31 29 0d 0a 09 69 6e 74 20 ..CASE(1)...int
1950: 6e 20 3d 20 37 3b 20 0d 0a 09 69 6e 74 20 69 64 n = 7; ...int id
1960: 31 5f 5b 5d 20 3d 20 7b 31 2c 32 2c 33 2c 34 2c 1_[] = {1,2,3,4,
1970: 35 2c 36 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 5,6};... vector
1980: 20 3c 69 6e 74 3e 20 69 64 31 28 69 64 31 5f 2c <int> id1(id1_,
1990: 20 69 64 31 5f 2b 73 69 7a 65 6f 66 28 69 64 31 id1_+sizeof(id1
19a0: 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 64 31 5f 29 _)/sizeof(*id1_)
19b0: 29 3b 20 0d 0a 09 69 6e 74 20 69 64 32 5f 5b 5d ); ...int id2_[]
19c0: 20 3d 20 7b 32 2c 33 2c 34 2c 35 2c 36 2c 37 7d = {2,3,4,5,6,7}
19d0: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e ;... vector <in
19e0: 74 3e 20 69 64 32 28 69 64 32 5f 2c 20 69 64 32 t> id2(id2_, id2
19f0: 5f 2b 73 69 7a 65 6f 66 28 69 64 32 5f 29 2f 73 _+sizeof(id2_)/s
1a00: 69 7a 65 6f 66 28 2a 69 64 32 5f 29 29 3b 20 0d izeof(*id2_)); .
1a10: 0a 09 73 74 72 69 6e 67 20 6f 70 5f 5b 5d 20 3d ..string op_[] =
1a20: 20 7b 22 2f 22 2c 22 2f 22 2c 22 2f 22 2c 22 2f {"/","/","/","/
1a30: 22 2c 22 2f 22 2c 22 2f 22 7d 3b 0d 0a 09 20 20 ","/","/"};...
1a40: 76 65 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 vector <string>
1a50: 6f 70 28 6f 70 5f 2c 20 6f 70 5f 2b 73 69 7a 65 op(op_, op_+size
1a60: 6f 66 28 6f 70 5f 29 2f 73 69 7a 65 6f 66 28 2a of(op_)/sizeof(*
1a70: 6f 70 5f 29 29 3b 20 0d 0a 09 73 74 72 69 6e 67 op_)); ...string
1a80: 20 72 6c 5f 5b 5d 20 3d 20 7b 22 3d 22 2c 22 3d rl_[] = {"=","=
1a90: 22 2c 22 3d 22 2c 22 3d 22 2c 22 3d 22 2c 22 3d ","=","=","=","=
1aa0: 22 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c "};... vector <
1ab0: 73 74 72 69 6e 67 3e 20 72 6c 28 72 6c 5f 2c 20 string> rl(rl_,
1ac0: 72 6c 5f 2b 73 69 7a 65 6f 66 28 72 6c 5f 29 2f rl_+sizeof(rl_)/
1ad0: 73 69 7a 65 6f 66 28 2a 72 6c 5f 29 29 3b 20 0d sizeof(*rl_)); .
1ae0: 0a 09 69 6e 74 20 76 61 6c 5f 5b 5d 20 3d 20 7b ..int val_[] = {
1af0: 32 30 30 30 2c 32 30 30 30 2c 32 30 30 30 2c 32 2000,2000,2000,2
1b00: 30 30 30 2c 32 30 30 30 2c 32 30 30 30 7d 3b 0d 000,2000,2000};.
1b10: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
1b20: 20 76 61 6c 28 76 61 6c 5f 2c 20 76 61 6c 5f 2b val(val_, val_+
1b30: 73 69 7a 65 6f 66 28 76 61 6c 5f 29 2f 73 69 7a sizeof(val_)/siz
1b40: 65 6f 66 28 2a 76 61 6c 5f 29 29 3b 20 0d 0a 09 eof(*val_)); ...
1b50: 69 6e 74 20 5f 5f 5b 5d 20 3d 20 7b 36 34 2c 20 int __[] = {64,
1b60: 33 32 2c 20 31 36 2c 20 38 2c 20 34 2c 20 32 2c 32, 16, 8, 4, 2,
1b70: 20 31 20 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 1 };... vector
1b80: 20 3c 69 6e 74 3e 20 5f 28 5f 5f 2c 20 5f 5f 2b <int> _(__, __+
1b90: 73 69 7a 65 6f 66 28 5f 5f 29 2f 73 69 7a 65 6f sizeof(__)/sizeo
1ba0: 66 28 2a 5f 5f 29 29 3b 20 0d 0a 45 4e 44 0d 0a f(*__)); ..END..
1bb0: 43 41 53 45 28 32 29 0d 0a 09 69 6e 74 20 6e 20 CASE(2)...int n
1bc0: 3d 20 32 3b 20 0d 0a 09 69 6e 74 20 69 64 31 5f = 2; ...int id1_
1bd0: 5b 5d 20 3d 20 7b 31 2c 31 7d 3b 0d 0a 09 20 20 [] = {1,1};...
1be0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 69 64 31 vector <int> id1
1bf0: 28 69 64 31 5f 2c 20 69 64 31 5f 2b 73 69 7a 65 (id1_, id1_+size
1c00: 6f 66 28 69 64 31 5f 29 2f 73 69 7a 65 6f 66 28 of(id1_)/sizeof(
1c10: 2a 69 64 31 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 *id1_)); ...int
1c20: 69 64 32 5f 5b 5d 20 3d 20 7b 32 2c 32 7d 3b 0d id2_[] = {2,2};.
1c30: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
1c40: 20 69 64 32 28 69 64 32 5f 2c 20 69 64 32 5f 2b id2(id2_, id2_+
1c50: 73 69 7a 65 6f 66 28 69 64 32 5f 29 2f 73 69 7a sizeof(id2_)/siz
1c60: 65 6f 66 28 2a 69 64 32 5f 29 29 3b 20 0d 0a 09 eof(*id2_)); ...
1c70: 73 74 72 69 6e 67 20 6f 70 5f 5b 5d 20 3d 20 7b string op_[] = {
1c80: 22 2f 22 2c 22 2f 22 7d 3b 0d 0a 09 20 20 76 65 "/","/"};... ve
1c90: 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 6f 70 ctor <string> op
1ca0: 28 6f 70 5f 2c 20 6f 70 5f 2b 73 69 7a 65 6f 66 (op_, op_+sizeof
1cb0: 28 6f 70 5f 29 2f 73 69 7a 65 6f 66 28 2a 6f 70 (op_)/sizeof(*op
1cc0: 5f 29 29 3b 20 0d 0a 09 73 74 72 69 6e 67 20 72 _)); ...string r
1cd0: 6c 5f 5b 5d 20 3d 20 7b 22 3e 22 2c 22 3c 22 7d l_[] = {">","<"}
1ce0: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 73 74 ;... vector <st
1cf0: 72 69 6e 67 3e 20 72 6c 28 72 6c 5f 2c 20 72 6c ring> rl(rl_, rl
1d00: 5f 2b 73 69 7a 65 6f 66 28 72 6c 5f 29 2f 73 69 _+sizeof(rl_)/si
1d10: 7a 65 6f 66 28 2a 72 6c 5f 29 29 3b 20 0d 0a 09 zeof(*rl_)); ...
1d20: 69 6e 74 20 76 61 6c 5f 5b 5d 20 3d 20 7b 32 36 int val_[] = {26
1d30: 32 31 2c 32 36 32 32 7d 3b 0d 0a 09 20 20 76 65 21,2622};... ve
1d40: 63 74 6f 72 20 3c 69 6e 74 3e 20 76 61 6c 28 76 ctor <int> val(v
1d50: 61 6c 5f 2c 20 76 61 6c 5f 2b 73 69 7a 65 6f 66 al_, val_+sizeof
1d60: 28 76 61 6c 5f 29 2f 73 69 7a 65 6f 66 28 2a 76 (val_)/sizeof(*v
1d70: 61 6c 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 5f 5f al_)); ...int __
1d80: 5b 5d 20 3d 20 7b 39 37 2c 20 33 37 20 7d 3b 0d [] = {97, 37 };.
1d90: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
1da0: 20 5f 28 5f 5f 2c 20 5f 5f 2b 73 69 7a 65 6f 66 _(__, __+sizeof
1db0: 28 5f 5f 29 2f 73 69 7a 65 6f 66 28 2a 5f 5f 29 (__)/sizeof(*__)
1dc0: 29 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 33 ); ..END..CASE(3
1dd0: 29 0d 0a 09 69 6e 74 20 6e 20 3d 20 32 3b 20 0d )...int n = 2; .
1de0: 0a 09 69 6e 74 20 69 64 31 5f 5b 5d 20 3d 20 7b ..int id1_[] = {
1df0: 31 2c 31 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 1,1};... vector
1e00: 20 3c 69 6e 74 3e 20 69 64 31 28 69 64 31 5f 2c <int> id1(id1_,
1e10: 20 69 64 31 5f 2b 73 69 7a 65 6f 66 28 69 64 31 id1_+sizeof(id1
1e20: 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 64 31 5f 29 _)/sizeof(*id1_)
1e30: 29 3b 20 0d 0a 09 69 6e 74 20 69 64 32 5f 5b 5d ); ...int id2_[]
1e40: 20 3d 20 7b 32 2c 32 7d 3b 0d 0a 09 20 20 76 65 = {2,2};... ve
1e50: 63 74 6f 72 20 3c 69 6e 74 3e 20 69 64 32 28 69 ctor <int> id2(i
1e60: 64 32 5f 2c 20 69 64 32 5f 2b 73 69 7a 65 6f 66 d2_, id2_+sizeof
1e70: 28 69 64 32 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 (id2_)/sizeof(*i
1e80: 64 32 5f 29 29 3b 20 0d 0a 09 73 74 72 69 6e 67 d2_)); ...string
1e90: 20 6f 70 5f 5b 5d 20 3d 20 7b 22 2a 22 2c 22 2b op_[] = {"*","+
1ea0: 22 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c "};... vector <
1eb0: 73 74 72 69 6e 67 3e 20 6f 70 28 6f 70 5f 2c 20 string> op(op_,
1ec0: 6f 70 5f 2b 73 69 7a 65 6f 66 28 6f 70 5f 29 2f op_+sizeof(op_)/
1ed0: 73 69 7a 65 6f 66 28 2a 6f 70 5f 29 29 3b 20 0d sizeof(*op_)); .
1ee0: 0a 09 73 74 72 69 6e 67 20 72 6c 5f 5b 5d 20 3d ..string rl_[] =
1ef0: 20 7b 22 3e 22 2c 22 3c 3d 22 7d 3b 0d 0a 09 20 {">","<="};...
1f00: 20 76 65 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e vector <string>
1f10: 20 72 6c 28 72 6c 5f 2c 20 72 6c 5f 2b 73 69 7a rl(rl_, rl_+siz
1f20: 65 6f 66 28 72 6c 5f 29 2f 73 69 7a 65 6f 66 28 eof(rl_)/sizeof(
1f30: 2a 72 6c 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 76 *rl_)); ...int v
1f40: 61 6c 5f 5b 5d 20 3d 20 7b 36 30 30 30 2c 35 30 al_[] = {6000,50
1f50: 30 30 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 00};... vector
1f60: 3c 69 6e 74 3e 20 76 61 6c 28 76 61 6c 5f 2c 20 <int> val(val_,
1f70: 76 61 6c 5f 2b 73 69 7a 65 6f 66 28 76 61 6c 5f val_+sizeof(val_
1f80: 29 2f 73 69 7a 65 6f 66 28 2a 76 61 6c 5f 29 29 )/sizeof(*val_))
1f90: 3b 20 0d 0a 09 76 65 63 74 6f 72 20 3c 69 6e 74 ; ...vector <int
1fa0: 3e 20 5f 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 > _; ..END..CASE
1fb0: 28 34 29 0d 0a 09 69 6e 74 20 6e 20 3d 20 38 3b (4)...int n = 8;
1fc0: 20 0d 0a 09 69 6e 74 20 69 64 31 5f 5b 5d 20 3d ...int id1_[] =
1fd0: 20 7b 31 2c 33 2c 35 2c 37 7d 3b 0d 0a 09 20 20 {1,3,5,7};...
1fe0: 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 69 64 31 vector <int> id1
1ff0: 28 69 64 31 5f 2c 20 69 64 31 5f 2b 73 69 7a 65 (id1_, id1_+size
2000: 6f 66 28 69 64 31 5f 29 2f 73 69 7a 65 6f 66 28 of(id1_)/sizeof(
2010: 2a 69 64 31 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 *id1_)); ...int
2020: 69 64 32 5f 5b 5d 20 3d 20 7b 32 2c 34 2c 36 2c id2_[] = {2,4,6,
2030: 38 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 8};... vector <
2040: 69 6e 74 3e 20 69 64 32 28 69 64 32 5f 2c 20 69 int> id2(id2_, i
2050: 64 32 5f 2b 73 69 7a 65 6f 66 28 69 64 32 5f 29 d2_+sizeof(id2_)
2060: 2f 73 69 7a 65 6f 66 28 2a 69 64 32 5f 29 29 3b /sizeof(*id2_));
2070: 20 0d 0a 09 73 74 72 69 6e 67 20 6f 70 5f 5b 5d ...string op_[]
2080: 20 3d 20 7b 22 2b 22 2c 22 2d 22 2c 22 2a 22 2c = {"+","-","*",
2090: 22 2f 22 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 "/"};... vector
20a0: 20 3c 73 74 72 69 6e 67 3e 20 6f 70 28 6f 70 5f <string> op(op_
20b0: 2c 20 6f 70 5f 2b 73 69 7a 65 6f 66 28 6f 70 5f , op_+sizeof(op_
20c0: 29 2f 73 69 7a 65 6f 66 28 2a 6f 70 5f 29 29 3b )/sizeof(*op_));
20d0: 20 0d 0a 09 73 74 72 69 6e 67 20 72 6c 5f 5b 5d ...string rl_[]
20e0: 20 3d 20 7b 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3d = {">=","<=","=
20f0: 22 2c 22 3c 3d 22 7d 3b 0d 0a 09 20 20 76 65 63 ","<="};... vec
2100: 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 72 6c 28 tor <string> rl(
2110: 72 6c 5f 2c 20 72 6c 5f 2b 73 69 7a 65 6f 66 28 rl_, rl_+sizeof(
2120: 72 6c 5f 29 2f 73 69 7a 65 6f 66 28 2a 72 6c 5f rl_)/sizeof(*rl_
2130: 29 29 3b 20 0d 0a 09 69 6e 74 20 76 61 6c 5f 5b )); ...int val_[
2140: 5d 20 3d 20 7b 32 30 30 30 30 30 2c 2d 39 39 30 ] = {200000,-990
2150: 30 30 2c 33 35 38 39 30 30 30 2c 31 30 7d 3b 0d 00,3589000,10};.
2160: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
2170: 20 76 61 6c 28 76 61 6c 5f 2c 20 76 61 6c 5f 2b val(val_, val_+
2180: 73 69 7a 65 6f 66 28 76 61 6c 5f 29 2f 73 69 7a sizeof(val_)/siz
2190: 65 6f 66 28 2a 76 61 6c 5f 29 29 3b 20 0d 0a 09 eof(*val_)); ...
21a0: 69 6e 74 20 5f 5f 5b 5d 20 3d 20 7b 31 30 30 2c int __[] = {100,
21b0: 20 31 30 30 2c 20 31 2c 20 31 30 30 2c 20 39 37 100, 1, 100, 97
21c0: 2c 20 33 37 2c 20 31 2c 20 31 30 30 20 7d 3b 0d , 37, 1, 100 };.
21d0: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
21e0: 20 5f 28 5f 5f 2c 20 5f 5f 2b 73 69 7a 65 6f 66 _(__, __+sizeof
21f0: 28 5f 5f 29 2f 73 69 7a 65 6f 66 28 2a 5f 5f 29 (__)/sizeof(*__)
2200: 29 3b 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 35 ); ..END..CASE(5
2210: 29 0d 0a 09 69 6e 74 20 6e 20 3d 20 38 3b 20 0d )...int n = 8; .
2220: 0a 09 69 6e 74 20 69 64 31 5f 5b 5d 20 3d 20 7b ..int id1_[] = {
2230: 37 2c 31 2c 33 2c 34 2c 34 2c 33 2c 37 2c 32 2c 7,1,3,4,4,3,7,2,
2240: 33 2c 36 2c 34 2c 34 2c 36 2c 35 2c 32 2c 38 2c 3,6,4,4,6,5,2,8,
2250: 32 2c 32 2c 37 2c 36 2c 32 2c 32 2c 38 2c 36 2c 2,2,7,6,2,2,8,6,
2260: 35 2c 36 2c 35 2c 34 2c 34 2c 38 2c 36 2c 31 2c 5,6,5,4,4,8,6,1,
2270: 33 2c 35 2c 35 2c 34 2c 33 2c 37 2c 34 2c 38 7d 3,5,5,4,3,7,4,8}
2280: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e ;... vector <in
2290: 74 3e 20 69 64 31 28 69 64 31 5f 2c 20 69 64 31 t> id1(id1_, id1
22a0: 5f 2b 73 69 7a 65 6f 66 28 69 64 31 5f 29 2f 73 _+sizeof(id1_)/s
22b0: 69 7a 65 6f 66 28 2a 69 64 31 5f 29 29 3b 20 0d izeof(*id1_)); .
22c0: 0a 09 69 6e 74 20 69 64 32 5f 5b 5d 20 3d 20 7b ..int id2_[] = {
22d0: 32 2c 37 2c 36 2c 36 2c 31 2c 32 2c 34 2c 37 2c 2,7,6,6,1,2,4,7,
22e0: 34 2c 34 2c 38 2c 33 2c 38 2c 32 2c 34 2c 31 2c 4,4,8,3,8,2,4,1,
22f0: 37 2c 37 2c 36 2c 32 2c 35 2c 37 2c 36 2c 35 2c 7,7,6,2,5,7,6,5,
2300: 38 2c 32 2c 38 2c 31 2c 38 2c 31 2c 33 2c 32 2c 8,2,8,1,8,1,3,2,
2310: 37 2c 31 2c 32 2c 32 2c 31 2c 38 2c 33 2c 33 7d 7,1,2,2,1,8,3,3}
2320: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e ;... vector <in
2330: 74 3e 20 69 64 32 28 69 64 32 5f 2c 20 69 64 32 t> id2(id2_, id2
2340: 5f 2b 73 69 7a 65 6f 66 28 69 64 32 5f 29 2f 73 _+sizeof(id2_)/s
2350: 69 7a 65 6f 66 28 2a 69 64 32 5f 29 29 3b 20 0d izeof(*id2_)); .
2360: 0a 09 73 74 72 69 6e 67 20 6f 70 5f 5b 5d 20 3d ..string op_[] =
2370: 20 7b 22 2f 22 2c 22 2a 22 2c 22 2f 22 2c 22 2d {"/","*","/","-
2380: 22 2c 22 2a 22 2c 22 2b 22 2c 22 2a 22 2c 22 2b ","*","+","*","+
2390: 22 2c 22 2f 22 2c 22 2b 22 2c 22 2d 22 2c 22 2b ","/","+","-","+
23a0: 22 2c 22 2a 22 2c 22 2b 22 2c 22 2f 22 2c 22 2a ","*","+","/","*
23b0: 22 2c 22 2d 22 2c 22 2f 22 2c 22 2d 22 2c 22 2a ","-","/","-","*
23c0: 22 2c 22 2f 22 2c 22 2f 22 2c 22 2f 22 2c 22 2a ","/","/","/","*
23d0: 22 2c 22 2f 22 2c 22 2b 22 2c 22 2b 22 2c 22 2a ","/","+","+","*
23e0: 22 2c 22 2a 22 2c 22 2d 22 2c 22 2d 22 2c 22 2a ","*","-","-","*
23f0: 22 2c 22 2b 22 2c 22 2b 22 2c 22 2b 22 2c 22 2d ","+","+","+","-
2400: 22 2c 22 2b 22 2c 22 2f 22 2c 22 2b 22 2c 22 2a ","+","/","+","*
2410: 22 7d 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c "};... vector <
2420: 73 74 72 69 6e 67 3e 20 6f 70 28 6f 70 5f 2c 20 string> op(op_,
2430: 6f 70 5f 2b 73 69 7a 65 6f 66 28 6f 70 5f 29 2f op_+sizeof(op_)/
2440: 73 69 7a 65 6f 66 28 2a 6f 70 5f 29 29 3b 20 0d sizeof(*op_)); .
2450: 0a 09 73 74 72 69 6e 67 20 72 6c 5f 5b 5d 20 3d ..string rl_[] =
2460: 20 7b 22 3c 22 2c 22 3c 22 2c 22 3c 3d 22 2c 22 {"<","<","<=","
2470: 3e 22 2c 22 3c 22 2c 22 3c 3d 22 2c 22 3c 22 2c >","<","<=","<",
2480: 22 3e 22 2c 22 3c 22 2c 22 3c 3d 22 2c 22 3c 3d ">","<","<=","<=
2490: 22 2c 22 3e 22 2c 22 3e 22 2c 22 3e 3d 22 2c 22 ",">",">",">=","
24a0: 3c 22 2c 22 3e 22 2c 22 3c 22 2c 22 3c 22 2c 22 <",">","<","<","
24b0: 3e 22 2c 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3c 22 >",">=","<=","<"
24c0: 2c 22 3c 3d 22 2c 22 3e 3d 22 2c 22 3c 3d 22 2c ,"<=",">=","<=",
24d0: 22 3e 3d 22 2c 22 3e 3d 22 2c 22 3e 3d 22 2c 22 ">=",">=",">=","
24e0: 3c 3d 22 2c 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3e <=",">=","<=",">
24f0: 22 2c 22 3c 3d 22 2c 22 3c 22 2c 22 3e 22 2c 22 ","<=","<",">","
2500: 3c 3d 22 2c 22 3e 3d 22 2c 22 3c 22 2c 22 3c 3d <=",">=","<","<=
2510: 22 2c 22 3c 3d 22 7d 3b 0d 0a 09 20 20 76 65 63 ","<="};... vec
2520: 74 6f 72 20 3c 73 74 72 69 6e 67 3e 20 72 6c 28 tor <string> rl(
2530: 72 6c 5f 2c 20 72 6c 5f 2b 73 69 7a 65 6f 66 28 rl_, rl_+sizeof(
2540: 72 6c 5f 29 2f 73 69 7a 65 6f 66 28 2a 72 6c 5f rl_)/sizeof(*rl_
2550: 29 29 3b 20 0d 0a 09 69 6e 74 20 76 61 6c 5f 5b )); ...int val_[
2560: 5d 20 3d 20 7b 34 37 36 33 36 2c 35 37 35 34 35 ] = {47636,57545
2570: 35 38 2c 33 33 30 37 2c 2d 34 31 34 39 36 2c 37 58,3307,-41496,7
2580: 30 34 33 32 38 36 2c 31 34 34 32 34 36 2c 35 30 043286,144246,50
2590: 34 38 32 30 33 2c 37 32 33 31 35 2c 38 35 33 38 48203,72315,8538
25a0: 34 2c 31 38 32 36 33 30 2c 35 30 36 30 34 2c 39 4,182630,50604,9
25b0: 38 30 32 2c 33 38 34 33 39 34 32 2c 31 35 32 33 802,3843942,1523
25c0: 39 32 2c 36 30 30 33 35 2c 31 34 39 36 38 34 2c 92,60035,149684,
25d0: 39 34 32 33 34 2c 33 31 32 30 39 2c 2d 37 33 38 94234,31209,-738
25e0: 39 38 2c 31 39 35 37 34 32 2c 38 33 38 33 2c 37 98,195742,8383,7
25f0: 31 39 39 33 2c 39 38 34 37 37 2c 34 38 35 39 33 1993,98477,48593
2600: 38 34 2c 37 34 36 31 39 2c 31 34 36 32 36 36 2c 84,74619,146266,
2610: 36 30 31 36 33 2c 33 37 37 35 36 34 2c 35 33 35 60163,377564,535
2620: 37 37 32 38 2c 2d 38 30 30 34 30 2c 37 32 35 34 7728,-80040,7254
2630: 35 2c 31 30 38 38 39 34 32 2c 38 37 35 31 37 2c 5,1088942,87517,
2640: 31 39 32 33 35 34 2c 31 38 36 32 39 2c 34 35 37 192354,18629,457
2650: 38 35 2c 34 34 31 35 31 2c 39 35 33 33 34 2c 31 85,44151,95334,1
2660: 34 30 33 36 30 2c 31 30 36 33 34 38 34 7d 3b 0d 40360,1063484};.
2670: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
2680: 20 76 61 6c 28 76 61 6c 5f 2c 20 76 61 6c 5f 2b val(val_, val_+
2690: 73 69 7a 65 6f 66 28 76 61 6c 5f 29 2f 73 69 7a sizeof(val_)/siz
26a0: 65 6f 66 28 2a 76 61 6c 5f 29 29 3b 20 0d 0a 09 eof(*val_)); ...
26b0: 69 6e 74 20 5f 5f 5b 5d 20 3d 20 7b 35 36 2c 20 int __[] = {56,
26c0: 37 37 2c 20 31 39 2c 20 35 39 2c 20 37 37 2c 20 77, 19, 59, 77,
26d0: 38 37 2c 20 34 33 2c 20 35 31 20 7d 3b 0d 0a 09 87, 43, 51 };...
26e0: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 5f vector <int> _
26f0: 28 5f 5f 2c 20 5f 5f 2b 73 69 7a 65 6f 66 28 5f (__, __+sizeof(_
2700: 5f 29 2f 73 69 7a 65 6f 66 28 2a 5f 5f 29 29 3b _)/sizeof(*__));
2710: 20 0d 0a 45 4e 44 0d 0a 43 41 53 45 28 36 29 0d ..END..CASE(6).
2720: 0a 09 69 6e 74 20 6e 20 3d 20 38 3b 20 0d 0a 09 ..int n = 8; ...
2730: 69 6e 74 20 69 64 31 5f 5b 5d 20 3d 20 7b 37 2c int id1_[] = {7,
2740: 31 2c 33 2c 34 2c 34 2c 33 2c 37 2c 32 2c 33 2c 1,3,4,4,3,7,2,3,
2750: 36 2c 34 2c 34 2c 36 2c 35 2c 32 2c 38 2c 32 2c 6,4,4,6,5,2,8,2,
2760: 32 2c 37 2c 36 2c 32 2c 32 2c 38 2c 36 2c 35 2c 2,7,6,2,2,8,6,5,
2770: 36 2c 35 2c 34 2c 34 2c 38 2c 36 2c 31 2c 33 2c 6,5,4,4,8,6,1,3,
2780: 35 2c 35 2c 34 2c 33 2c 37 2c 34 2c 38 7d 3b 0d 5,5,4,3,7,4,8};.
2790: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
27a0: 20 69 64 31 28 69 64 31 5f 2c 20 69 64 31 5f 2b id1(id1_, id1_+
27b0: 73 69 7a 65 6f 66 28 69 64 31 5f 29 2f 73 69 7a sizeof(id1_)/siz
27c0: 65 6f 66 28 2a 69 64 31 5f 29 29 3b 20 0d 0a 09 eof(*id1_)); ...
27d0: 69 6e 74 20 69 64 32 5f 5b 5d 20 3d 20 7b 32 2c int id2_[] = {2,
27e0: 37 2c 36 2c 36 2c 31 2c 32 2c 34 2c 37 2c 34 2c 7,6,6,1,2,4,7,4,
27f0: 34 2c 38 2c 33 2c 38 2c 32 2c 34 2c 31 2c 37 2c 4,8,3,8,2,4,1,7,
2800: 37 2c 36 2c 32 2c 35 2c 37 2c 36 2c 35 2c 38 2c 7,6,2,5,7,6,5,8,
2810: 32 2c 38 2c 31 2c 38 2c 31 2c 33 2c 32 2c 37 2c 2,8,1,8,1,3,2,7,
2820: 31 2c 32 2c 32 2c 31 2c 38 2c 33 2c 33 7d 3b 0d 1,2,2,1,8,3,3};.
2830: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
2840: 20 69 64 32 28 69 64 32 5f 2c 20 69 64 32 5f 2b id2(id2_, id2_+
2850: 73 69 7a 65 6f 66 28 69 64 32 5f 29 2f 73 69 7a sizeof(id2_)/siz
2860: 65 6f 66 28 2a 69 64 32 5f 29 29 3b 20 0d 0a 09 eof(*id2_)); ...
2870: 73 74 72 69 6e 67 20 6f 70 5f 5b 5d 20 3d 20 7b string op_[] = {
2880: 22 2f 22 2c 22 2a 22 2c 22 2f 22 2c 22 2d 22 2c "/","*","/","-",
2890: 22 2a 22 2c 22 2b 22 2c 22 2a 22 2c 22 2b 22 2c "*","+","*","+",
28a0: 22 2f 22 2c 22 2b 22 2c 22 2d 22 2c 22 2b 22 2c "/","+","-","+",
28b0: 22 2a 22 2c 22 2b 22 2c 22 2f 22 2c 22 2a 22 2c "*","+","/","*",
28c0: 22 2d 22 2c 22 2f 22 2c 22 2d 22 2c 22 2a 22 2c "-","/","-","*",
28d0: 22 2f 22 2c 22 2f 22 2c 22 2f 22 2c 22 2a 22 2c "/","/","/","*",
28e0: 22 2f 22 2c 22 2b 22 2c 22 2b 22 2c 22 2a 22 2c "/","+","+","*",
28f0: 22 2a 22 2c 22 2d 22 2c 22 2d 22 2c 22 2a 22 2c "*","-","-","*",
2900: 22 2b 22 2c 22 2b 22 2c 22 2b 22 2c 22 2d 22 2c "+","+","+","-",
2910: 22 2b 22 2c 22 2f 22 2c 22 2b 22 2c 22 2a 22 7d "+","/","+","*"}
2920: 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 73 74 ;... vector <st
2930: 72 69 6e 67 3e 20 6f 70 28 6f 70 5f 2c 20 6f 70 ring> op(op_, op
2940: 5f 2b 73 69 7a 65 6f 66 28 6f 70 5f 29 2f 73 69 _+sizeof(op_)/si
2950: 7a 65 6f 66 28 2a 6f 70 5f 29 29 3b 20 0d 0a 09 zeof(*op_)); ...
2960: 73 74 72 69 6e 67 20 72 6c 5f 5b 5d 20 3d 20 7b string rl_[] = {
2970: 22 3d 22 2c 22 3c 22 2c 22 3c 3d 22 2c 22 3e 22 "=","<","<=",">"
2980: 2c 22 3c 22 2c 22 3c 3d 22 2c 22 3c 22 2c 22 3e ,"<","<=","<",">
2990: 22 2c 22 3c 22 2c 22 3c 3d 22 2c 22 3c 3d 22 2c ","<","<=","<=",
29a0: 22 3e 22 2c 22 3e 22 2c 22 3e 3d 22 2c 22 3c 22 ">",">",">=","<"
29b0: 2c 22 3e 22 2c 22 3c 22 2c 22 3c 22 2c 22 3e 22 ,">","<","<",">"
29c0: 2c 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3c 22 2c 22 ,">=","<=","<","
29d0: 3c 3d 22 2c 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3e <=",">=","<=",">
29e0: 3d 22 2c 22 3e 3d 22 2c 22 3e 3d 22 2c 22 3c 3d =",">=",">=","<=
29f0: 22 2c 22 3e 3d 22 2c 22 3c 3d 22 2c 22 3e 22 2c ",">=","<=",">",
2a00: 22 3c 3d 22 2c 22 3c 22 2c 22 3e 22 2c 22 3c 3d "<=","<",">","<=
2a10: 22 2c 22 3e 3d 22 2c 22 3c 22 2c 22 3c 3d 22 2c ",">=","<","<=",
2a20: 22 3c 3d 22 7d 3b 0d 0a 09 20 20 76 65 63 74 6f "<="};... vecto
2a30: 72 20 3c 73 74 72 69 6e 67 3e 20 72 6c 28 72 6c r <string> rl(rl
2a40: 5f 2c 20 72 6c 5f 2b 73 69 7a 65 6f 66 28 72 6c _, rl_+sizeof(rl
2a50: 5f 29 2f 73 69 7a 65 6f 66 28 2a 72 6c 5f 29 29 _)/sizeof(*rl_))
2a60: 3b 20 0d 0a 09 69 6e 74 20 76 61 6c 5f 5b 5d 20 ; ...int val_[]
2a70: 3d 20 7b 32 30 30 30 2c 35 37 35 34 35 35 38 2c = {2000,5754558,
2a80: 33 33 30 37 2c 2d 34 31 34 39 36 2c 37 30 34 33 3307,-41496,7043
2a90: 32 38 36 2c 31 34 34 32 34 36 2c 35 30 34 38 32 286,144246,50482
2aa0: 30 33 2c 37 32 33 31 35 2c 38 35 33 38 34 2c 31 03,72315,85384,1
2ab0: 38 32 36 33 30 2c 35 30 36 30 34 2c 39 38 30 32 82630,50604,9802
2ac0: 2c 33 38 34 33 39 34 32 2c 31 35 32 33 39 32 2c ,3843942,152392,
2ad0: 36 30 30 33 35 2c 31 34 39 36 38 34 2c 39 34 32 60035,149684,942
2ae0: 33 34 2c 33 31 32 30 39 2c 2d 37 33 38 39 38 2c 34,31209,-73898,
2af0: 31 39 35 37 34 32 2c 38 33 38 33 2c 37 31 39 39 195742,8383,7199
2b00: 33 2c 39 38 34 37 37 2c 34 38 35 39 33 38 34 2c 3,98477,4859384,
2b10: 37 34 36 31 39 2c 31 34 36 32 36 36 2c 36 30 31 74619,146266,601
2b20: 36 33 2c 33 37 37 35 36 34 2c 35 33 35 37 37 32 63,377564,535772
2b30: 38 2c 2d 38 30 30 34 30 2c 37 32 35 34 35 2c 31 8,-80040,72545,1
2b40: 30 38 38 39 34 32 2c 38 37 35 31 37 2c 31 39 32 088942,87517,192
2b50: 33 35 34 2c 31 38 36 32 39 2c 34 35 37 38 35 2c 354,18629,45785,
2b60: 34 34 31 35 31 2c 39 35 33 33 34 2c 31 34 30 33 44151,95334,1403
2b70: 36 30 2c 31 30 36 33 34 38 34 7d 3b 0d 0a 09 20 60,1063484};...
2b80: 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 76 61 vector <int> va
2b90: 6c 28 76 61 6c 5f 2c 20 76 61 6c 5f 2b 73 69 7a l(val_, val_+siz
2ba0: 65 6f 66 28 76 61 6c 5f 29 2f 73 69 7a 65 6f 66 eof(val_)/sizeof
2bb0: 28 2a 76 61 6c 5f 29 29 3b 20 0d 0a 09 76 65 63 (*val_)); ...vec
2bc0: 74 6f 72 20 3c 69 6e 74 3e 20 5f 3b 20 0d 0a 45 tor <int> _; ..E
2bd0: 4e 44 0d 0a 2f 2a 0d 0a 43 41 53 45 28 37 29 0d ND../*..CASE(7).
2be0: 0a 09 69 6e 74 20 6e 20 3d 20 3b 20 0d 0a 09 69 ..int n = ; ...i
2bf0: 6e 74 20 69 64 31 5f 5b 5d 20 3d 20 3b 0d 0a 09 nt id1_[] = ;...
2c00: 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 69 vector <int> i
2c10: 64 31 28 69 64 31 5f 2c 20 69 64 31 5f 2b 73 69 d1(id1_, id1_+si
2c20: 7a 65 6f 66 28 69 64 31 5f 29 2f 73 69 7a 65 6f zeof(id1_)/sizeo
2c30: 66 28 2a 69 64 31 5f 29 29 3b 20 0d 0a 09 69 6e f(*id1_)); ...in
2c40: 74 20 69 64 32 5f 5b 5d 20 3d 20 3b 0d 0a 09 20 t id2_[] = ;...
2c50: 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e 20 69 64 vector <int> id
2c60: 32 28 69 64 32 5f 2c 20 69 64 32 5f 2b 73 69 7a 2(id2_, id2_+siz
2c70: 65 6f 66 28 69 64 32 5f 29 2f 73 69 7a 65 6f 66 eof(id2_)/sizeof
2c80: 28 2a 69 64 32 5f 29 29 3b 20 0d 0a 09 73 74 72 (*id2_)); ...str
2c90: 69 6e 67 20 6f 70 5f 5b 5d 20 3d 20 3b 0d 0a 09 ing op_[] = ;...
2ca0: 20 20 76 65 63 74 6f 72 20 3c 73 74 72 69 6e 67 vector <string
2cb0: 3e 20 6f 70 28 6f 70 5f 2c 20 6f 70 5f 2b 73 69 > op(op_, op_+si
2cc0: 7a 65 6f 66 28 6f 70 5f 29 2f 73 69 7a 65 6f 66 zeof(op_)/sizeof
2cd0: 28 2a 6f 70 5f 29 29 3b 20 0d 0a 09 73 74 72 69 (*op_)); ...stri
2ce0: 6e 67 20 72 6c 5f 5b 5d 20 3d 20 3b 0d 0a 09 20 ng rl_[] = ;...
2cf0: 20 76 65 63 74 6f 72 20 3c 73 74 72 69 6e 67 3e vector <string>
2d00: 20 72 6c 28 72 6c 5f 2c 20 72 6c 5f 2b 73 69 7a rl(rl_, rl_+siz
2d10: 65 6f 66 28 72 6c 5f 29 2f 73 69 7a 65 6f 66 28 eof(rl_)/sizeof(
2d20: 2a 72 6c 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 76 *rl_)); ...int v
2d30: 61 6c 5f 5b 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 al_[] = ;... ve
2d40: 63 74 6f 72 20 3c 69 6e 74 3e 20 76 61 6c 28 76 ctor <int> val(v
2d50: 61 6c 5f 2c 20 76 61 6c 5f 2b 73 69 7a 65 6f 66 al_, val_+sizeof
2d60: 28 76 61 6c 5f 29 2f 73 69 7a 65 6f 66 28 2a 76 (val_)/sizeof(*v
2d70: 61 6c 5f 29 29 3b 20 0d 0a 09 69 6e 74 20 5f 5f al_)); ...int __
2d80: 5b 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f [] = ;... vecto
2d90: 72 20 3c 69 6e 74 3e 20 5f 28 5f 5f 2c 20 5f 5f r <int> _(__, __
2da0: 2b 73 69 7a 65 6f 66 28 5f 5f 29 2f 73 69 7a 65 +sizeof(__)/size
2db0: 6f 66 28 2a 5f 5f 29 29 3b 20 0d 0a 45 4e 44 0d of(*__)); ..END.
2dc0: 0a 43 41 53 45 28 38 29 0d 0a 09 69 6e 74 20 6e .CASE(8)...int n
2dd0: 20 3d 20 3b 20 0d 0a 09 69 6e 74 20 69 64 31 5f = ; ...int id1_
2de0: 5b 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f [] = ;... vecto
2df0: 72 20 3c 69 6e 74 3e 20 69 64 31 28 69 64 31 5f r <int> id1(id1_
2e00: 2c 20 69 64 31 5f 2b 73 69 7a 65 6f 66 28 69 64 , id1_+sizeof(id
2e10: 31 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 64 31 5f 1_)/sizeof(*id1_
2e20: 29 29 3b 20 0d 0a 09 69 6e 74 20 69 64 32 5f 5b )); ...int id2_[
2e30: 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 ] = ;... vector
2e40: 20 3c 69 6e 74 3e 20 69 64 32 28 69 64 32 5f 2c <int> id2(id2_,
2e50: 20 69 64 32 5f 2b 73 69 7a 65 6f 66 28 69 64 32 id2_+sizeof(id2
2e60: 5f 29 2f 73 69 7a 65 6f 66 28 2a 69 64 32 5f 29 _)/sizeof(*id2_)
2e70: 29 3b 20 0d 0a 09 73 74 72 69 6e 67 20 6f 70 5f ); ...string op_
2e80: 5b 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f [] = ;... vecto
2e90: 72 20 3c 73 74 72 69 6e 67 3e 20 6f 70 28 6f 70 r <string> op(op
2ea0: 5f 2c 20 6f 70 5f 2b 73 69 7a 65 6f 66 28 6f 70 _, op_+sizeof(op
2eb0: 5f 29 2f 73 69 7a 65 6f 66 28 2a 6f 70 5f 29 29 _)/sizeof(*op_))
2ec0: 3b 20 0d 0a 09 73 74 72 69 6e 67 20 72 6c 5f 5b ; ...string rl_[
2ed0: 5d 20 3d 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 ] = ;... vector
2ee0: 20 3c 73 74 72 69 6e 67 3e 20 72 6c 28 72 6c 5f <string> rl(rl_
2ef0: 2c 20 72 6c 5f 2b 73 69 7a 65 6f 66 28 72 6c 5f , rl_+sizeof(rl_
2f00: 29 2f 73 69 7a 65 6f 66 28 2a 72 6c 5f 29 29 3b )/sizeof(*rl_));
2f10: 20 0d 0a 09 69 6e 74 20 76 61 6c 5f 5b 5d 20 3d ...int val_[] =
2f20: 20 3b 0d 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 ;... vector <i
2f30: 6e 74 3e 20 76 61 6c 28 76 61 6c 5f 2c 20 76 61 nt> val(val_, va
2f40: 6c 5f 2b 73 69 7a 65 6f 66 28 76 61 6c 5f 29 2f l_+sizeof(val_)/
2f50: 73 69 7a 65 6f 66 28 2a 76 61 6c 5f 29 29 3b 20 sizeof(*val_));
2f60: 0d 0a 09 69 6e 74 20 5f 5f 5b 5d 20 3d 20 3b 0d ...int __[] = ;.
2f70: 0a 09 20 20 76 65 63 74 6f 72 20 3c 69 6e 74 3e .. vector <int>
2f80: 20 5f 28 5f 5f 2c 20 5f 5f 2b 73 69 7a 65 6f 66 _(__, __+sizeof
2f90: 28 5f 5f 29 2f 73 69 7a 65 6f 66 28 2a 5f 5f 29 (__)/sizeof(*__)
2fa0: 29 3b 20 0d 0a 45 4e 44 0d 0a 2a 2f 0d 0a 7d 0d ); ..END..*/..}.
2fb0: 0a 2f 2f 20 45 4e 44 20 43 55 54 20 48 45 52 45 .// END CUT HERE
2fc0: 0d 0a ..