589fb61dc1 2014-08-30 kinaba: #include <iostream> 589fb61dc1 2014-08-30 kinaba: #include <sstream> 589fb61dc1 2014-08-30 kinaba: #include <iomanip> 589fb61dc1 2014-08-30 kinaba: #include <vector> 589fb61dc1 2014-08-30 kinaba: #include <string> 589fb61dc1 2014-08-30 kinaba: #include <map> 589fb61dc1 2014-08-30 kinaba: #include <set> 589fb61dc1 2014-08-30 kinaba: #include <algorithm> 589fb61dc1 2014-08-30 kinaba: #include <numeric> 589fb61dc1 2014-08-30 kinaba: #include <iterator> 589fb61dc1 2014-08-30 kinaba: #include <functional> 589fb61dc1 2014-08-30 kinaba: #include <complex> 589fb61dc1 2014-08-30 kinaba: #include <queue> 589fb61dc1 2014-08-30 kinaba: #include <stack> 589fb61dc1 2014-08-30 kinaba: #include <cmath> 589fb61dc1 2014-08-30 kinaba: #include <cassert> 589fb61dc1 2014-08-30 kinaba: #include <tuple> 589fb61dc1 2014-08-30 kinaba: using namespace std; 589fb61dc1 2014-08-30 kinaba: typedef long long LL; 589fb61dc1 2014-08-30 kinaba: typedef complex<double> CMP; 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: class NeverAskHerAge { public: 589fb61dc1 2014-08-30 kinaba: vector <int> possibleSolution(int n, vector <int> id1, vector <int> id2, vector <string> op, vector <string> rl, vector <int> val) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: // !!!Being a geek, Jiro has to perfer 0-origin numbering!!! 589fb61dc1 2014-08-30 kinaba: for(auto& g: id1) --g; 589fb61dc1 2014-08-30 kinaba: for(auto& g: id2) --g; 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: for(auto& s: rl) {if(s=="<=") s="L"; if(s==">=") s="G";} 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: // check obviously false conditions. 589fb61dc1 2014-08-30 kinaba: for(int i=0; i<id1.size(); ++i) if(rl[i]=="=") { 589fb61dc1 2014-08-30 kinaba: if(op[i]=="/") { 589fb61dc1 2014-08-30 kinaba: if(val[i]==0) 589fb61dc1 2014-08-30 kinaba: return vector<int>(); 589fb61dc1 2014-08-30 kinaba: continue; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: if(val[i]%1000 != 0) 589fb61dc1 2014-08-30 kinaba: return vector<int>(); 589fb61dc1 2014-08-30 kinaba: int v = val[i] / 1000; 589fb61dc1 2014-08-30 kinaba: if(op[i]=="+" && (v<2 || v>200)) return vector<int>(); 589fb61dc1 2014-08-30 kinaba: if(op[i]=="-" && (v<-99 || v>99)) return vector<int>(); 589fb61dc1 2014-08-30 kinaba: if(op[i]=="*") { 589fb61dc1 2014-08-30 kinaba: if(v<1 || 10000<v) return vector<int>(); 589fb61dc1 2014-08-30 kinaba: for(int p=2; p*p<=v; ++p) 589fb61dc1 2014-08-30 kinaba: while(v%p==0)v/=p; 589fb61dc1 2014-08-30 kinaba: if(v>100) return vector<int>(); 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: // Relevant constraints 589fb61dc1 2014-08-30 kinaba: vector<set<int>> rel(n); 589fb61dc1 2014-08-30 kinaba: for(int i=0; i<id1.size(); ++i) rel[id1[i]].insert(i); 589fb61dc1 2014-08-30 kinaba: for(int i=0; i<id2.size(); ++i) rel[id2[i]].insert(i); 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: // Try highly constrained girl first. 589fb61dc1 2014-08-30 kinaba: vector<int> girls; for(int g=0; g<n; ++g) girls.push_back(g); 589fb61dc1 2014-08-30 kinaba: sort(girls.begin(), girls.end(), [&](int g1, int g2){return rel[g1].size()>rel[g2].size();}); 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: const int UNDETERMINED = 0; 589fb61dc1 2014-08-30 kinaba: vector<int> x(n, UNDETERMINED); 589fb61dc1 2014-08-30 kinaba: function<bool(int)> rec; 589fb61dc1 2014-08-30 kinaba: rec = [&](int gi){ 589fb61dc1 2014-08-30 kinaba: if(gi == n) 589fb61dc1 2014-08-30 kinaba: return true; 589fb61dc1 2014-08-30 kinaba: int g = girls[gi]; 589fb61dc1 2014-08-30 kinaba: for(int age=1; age<=100; ++age) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: x[g] = age; 589fb61dc1 2014-08-30 kinaba: bool bad = false; 589fb61dc1 2014-08-30 kinaba: for(int i: rel[g]) if(x[id1[i]]!=UNDETERMINED && x[id2[i]]!=UNDETERMINED) { 589fb61dc1 2014-08-30 kinaba: if(!ok(x[id1[i]], op[i][0], x[id2[i]], rl[i][0], val[i])) 589fb61dc1 2014-08-30 kinaba: {bad=true; break;} 589fb61dc1 2014-08-30 kinaba: } else { 589fb61dc1 2014-08-30 kinaba: if(!ok_part(x[id1[i]], op[i][0], x[id2[i]], rl[i][0], val[i])) 589fb61dc1 2014-08-30 kinaba: {bad=true; break;} 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: if(!bad && rec(gi+1)) 589fb61dc1 2014-08-30 kinaba: return true; 589fb61dc1 2014-08-30 kinaba: x[g] = UNDETERMINED; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: }; 589fb61dc1 2014-08-30 kinaba: if(!rec(0)) return vector<int>(); 589fb61dc1 2014-08-30 kinaba: return x; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: static bool ok(int x1, char op, int x2, char rl, int val) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: switch(op) { 589fb61dc1 2014-08-30 kinaba: case '+': return ok((x1+x2)*1000, rl, val); 589fb61dc1 2014-08-30 kinaba: case '-': return ok((x1-x2)*1000, rl, val); 589fb61dc1 2014-08-30 kinaba: case '*': return ok((x1*x2)*1000, rl, val); 589fb61dc1 2014-08-30 kinaba: case '/': return ok((x1)*1000, rl, val*x2); 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: static bool ok(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return x < y; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return x <= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return x > y; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return x >= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return x == y; 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: static bool ok_part(int x1, char op, int x2, char rl, int val) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: switch(op) { 589fb61dc1 2014-08-30 kinaba: case '+': return ok_part_plus(max(x1,x2), rl, val); 589fb61dc1 2014-08-30 kinaba: case '-': return x1 ? ok_part_minusl(x1, rl, val) 589fb61dc1 2014-08-30 kinaba: : ok_part_minusr(x2, rl, val); 589fb61dc1 2014-08-30 kinaba: case '*': return ok_part_mult(max(x1,x2), rl, val); 589fb61dc1 2014-08-30 kinaba: case '/': return x1 ? ok_part_divl(x1, rl, val) 589fb61dc1 2014-08-30 kinaba: : ok_part_divr(x2, rl, val); 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: return true; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // (x + ?)*1000 rel y 589fb61dc1 2014-08-30 kinaba: static bool ok_part_plus(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return (x+1)*1000 < y; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return (x+1)*1000 <= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return (x+100)*1000 > y; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return (x+100)*1000 >= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return (x+1)*1000<=y && y<=(x+100)*1000; 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // (x - ?)*1000 rel y 589fb61dc1 2014-08-30 kinaba: static bool ok_part_minusl(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return (x-100)*1000 < y; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return (x-100)*1000 <= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return (x-1)*1000 > y; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return (x-1)*1000 >= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return (x-100)*1000<=y && y<=(x-1)*1000; 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // (? - x)*1000 rel y 589fb61dc1 2014-08-30 kinaba: static bool ok_part_minusr(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return (1-x)*1000 < y; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return (1-x)*1000 <= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return (100-x)*1000 > y; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return (100-x)*1000 >= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return (1-x)*1000<=y && y<=(100-x)*1000; 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // (x * ?)*1000 rel y 589fb61dc1 2014-08-30 kinaba: static bool ok_part_mult(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return (x*1)*1000 < y; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return (x*1)*1000 <= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return (x*100)*1000 > y; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return (x*100)*1000 >= y; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return (x*1)*1000<=y && y<=(x*100)*1000 && y%(x*1000)==0; 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // (x / ?)*1000 rel y 589fb61dc1 2014-08-30 kinaba: static bool ok_part_divl(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: if(rel=='<') return x*1000 < y*100; 589fb61dc1 2014-08-30 kinaba: if(rel=='L') return x*1000 <= y*100; 589fb61dc1 2014-08-30 kinaba: if(rel=='>') return x*1000 > y*1; 589fb61dc1 2014-08-30 kinaba: if(rel=='G') return x*1000 >= y*1; 589fb61dc1 2014-08-30 kinaba: if(rel=='=') return x*1000 <= y*100 && x*1000 >= y*1 && (x*1000%y==0); 589fb61dc1 2014-08-30 kinaba: return false; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: static bool ok_part_divr(int x, char rel, int y) 589fb61dc1 2014-08-30 kinaba: { 589fb61dc1 2014-08-30 kinaba: return true; 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: }; 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: // BEGIN CUT HERE 589fb61dc1 2014-08-30 kinaba: #include <ctime> 589fb61dc1 2014-08-30 kinaba: double start_time; string timer() 589fb61dc1 2014-08-30 kinaba: { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } 589fb61dc1 2014-08-30 kinaba: template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) 589fb61dc1 2014-08-30 kinaba: { os << "{ "; 589fb61dc1 2014-08-30 kinaba: for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it) 589fb61dc1 2014-08-30 kinaba: os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } 589fb61dc1 2014-08-30 kinaba: void verify_case(const vector <int>& Expected, const vector <int>& Received) { 589fb61dc1 2014-08-30 kinaba: bool ok = (Expected == Received); 589fb61dc1 2014-08-30 kinaba: if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; 589fb61dc1 2014-08-30 kinaba: cerr << "\to: " << Expected << endl << "\tx: " << Received << endl; } } 589fb61dc1 2014-08-30 kinaba: #define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); 589fb61dc1 2014-08-30 kinaba: #define END verify_case(_, NeverAskHerAge().possibleSolution(n, id1, id2, op, rl, val));} 589fb61dc1 2014-08-30 kinaba: int main(){ 589fb61dc1 2014-08-30 kinaba: 589fb61dc1 2014-08-30 kinaba: CASE(0) 589fb61dc1 2014-08-30 kinaba: int n = 2; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {1,1}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,2}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"+","*"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {"=","="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {10000,21000}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = {3, 7 }; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(1) 589fb61dc1 2014-08-30 kinaba: int n = 7; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {1,2,3,4,5,6}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,3,4,5,6,7}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"/","/","/","/","/","/"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {"=","=","=","=","=","="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {2000,2000,2000,2000,2000,2000}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = {64, 32, 16, 8, 4, 2, 1 }; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(2) 589fb61dc1 2014-08-30 kinaba: int n = 2; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {1,1}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,2}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"/","/"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {">","<"}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {2621,2622}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = {97, 37 }; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(3) 589fb61dc1 2014-08-30 kinaba: int n = 2; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {1,1}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,2}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"*","+"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {">","<="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {6000,5000}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: vector <int> _; 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(4) 589fb61dc1 2014-08-30 kinaba: int n = 8; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {1,3,5,7}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,4,6,8}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"+","-","*","/"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {">=","<=","=","<="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {200000,-99000,3589000,10}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = {100, 100, 1, 100, 97, 37, 1, 100 }; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(5) 589fb61dc1 2014-08-30 kinaba: int n = 8; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {7,1,3,4,4,3,7,2,3,6,4,4,6,5,2,8,2,2,7,6,2,2,8,6,5,6,5,4,4,8,6,1,3,5,5,4,3,7,4,8}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,7,6,6,1,2,4,7,4,4,8,3,8,2,4,1,7,7,6,2,5,7,6,5,8,2,8,1,8,1,3,2,7,1,2,2,1,8,3,3}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"/","*","/","-","*","+","*","+","/","+","-","+","*","+","/","*","-","/","-","*","/","/","/","*","/","+","+","*","*","-","-","*","+","+","+","-","+","/","+","*"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {"<","<","<=",">","<","<=","<",">","<","<=","<=",">",">",">=","<",">","<","<",">",">=","<=","<","<=",">=","<=",">=",">=",">=","<=",">=","<=",">","<=","<",">","<=",">=","<","<=","<="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {47636,5754558,3307,-41496,7043286,144246,5048203,72315,85384,182630,50604,9802,3843942,152392,60035,149684,94234,31209,-73898,195742,8383,71993,98477,4859384,74619,146266,60163,377564,5357728,-80040,72545,1088942,87517,192354,18629,45785,44151,95334,140360,1063484}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = {56, 77, 19, 59, 77, 87, 43, 51 }; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(6) 589fb61dc1 2014-08-30 kinaba: int n = 8; 589fb61dc1 2014-08-30 kinaba: int id1_[] = {7,1,3,4,4,3,7,2,3,6,4,4,6,5,2,8,2,2,7,6,2,2,8,6,5,6,5,4,4,8,6,1,3,5,5,4,3,7,4,8}; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = {2,7,6,6,1,2,4,7,4,4,8,3,8,2,4,1,7,7,6,2,5,7,6,5,8,2,8,1,8,1,3,2,7,1,2,2,1,8,3,3}; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = {"/","*","/","-","*","+","*","+","/","+","-","+","*","+","/","*","-","/","-","*","/","/","/","*","/","+","+","*","*","-","-","*","+","+","+","-","+","/","+","*"}; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = {"=","<","<=",">","<","<=","<",">","<","<=","<=",">",">",">=","<",">","<","<",">",">=","<=","<","<=",">=","<=",">=",">=",">=","<=",">=","<=",">","<=","<",">","<=",">=","<","<=","<="}; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = {2000,5754558,3307,-41496,7043286,144246,5048203,72315,85384,182630,50604,9802,3843942,152392,60035,149684,94234,31209,-73898,195742,8383,71993,98477,4859384,74619,146266,60163,377564,5357728,-80040,72545,1088942,87517,192354,18629,45785,44151,95334,140360,1063484}; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: vector <int> _; 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: /* 589fb61dc1 2014-08-30 kinaba: CASE(7) 589fb61dc1 2014-08-30 kinaba: int n = ; 589fb61dc1 2014-08-30 kinaba: int id1_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: CASE(8) 589fb61dc1 2014-08-30 kinaba: int n = ; 589fb61dc1 2014-08-30 kinaba: int id1_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> id1(id1_, id1_+sizeof(id1_)/sizeof(*id1_)); 589fb61dc1 2014-08-30 kinaba: int id2_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> id2(id2_, id2_+sizeof(id2_)/sizeof(*id2_)); 589fb61dc1 2014-08-30 kinaba: string op_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <string> op(op_, op_+sizeof(op_)/sizeof(*op_)); 589fb61dc1 2014-08-30 kinaba: string rl_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <string> rl(rl_, rl_+sizeof(rl_)/sizeof(*rl_)); 589fb61dc1 2014-08-30 kinaba: int val_[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> val(val_, val_+sizeof(val_)/sizeof(*val_)); 589fb61dc1 2014-08-30 kinaba: int __[] = ; 589fb61dc1 2014-08-30 kinaba: vector <int> _(__, __+sizeof(__)/sizeof(*__)); 589fb61dc1 2014-08-30 kinaba: END 589fb61dc1 2014-08-30 kinaba: */ 589fb61dc1 2014-08-30 kinaba: } 589fb61dc1 2014-08-30 kinaba: // END CUT HERE