File Annotation
Not logged in
98499b8c6b 2011-11-12        kinaba: #include <iostream>
98499b8c6b 2011-11-12        kinaba: #include <sstream>
98499b8c6b 2011-11-12        kinaba: #include <iomanip>
98499b8c6b 2011-11-12        kinaba: #include <vector>
98499b8c6b 2011-11-12        kinaba: #include <string>
98499b8c6b 2011-11-12        kinaba: #include <map>
98499b8c6b 2011-11-12        kinaba: #include <set>
98499b8c6b 2011-11-12        kinaba: #include <algorithm>
98499b8c6b 2011-11-12        kinaba: #include <numeric>
98499b8c6b 2011-11-12        kinaba: #include <iterator>
98499b8c6b 2011-11-12        kinaba: #include <functional>
98499b8c6b 2011-11-12        kinaba: #include <complex>
98499b8c6b 2011-11-12        kinaba: #include <queue>
98499b8c6b 2011-11-12        kinaba: #include <stack>
98499b8c6b 2011-11-12        kinaba: #include <cmath>
98499b8c6b 2011-11-12        kinaba: #include <cassert>
98499b8c6b 2011-11-12        kinaba: #include <cstring>
98499b8c6b 2011-11-12        kinaba: using namespace std;
98499b8c6b 2011-11-12        kinaba: typedef long long LL;
98499b8c6b 2011-11-12        kinaba: typedef complex<double> CMP;
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: class PointErasing { public:
98499b8c6b 2011-11-12        kinaba: 	vector<int> ans;
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: 	vector <int> getOutcomes(vector <int> y)
98499b8c6b 2011-11-12        kinaba: 	{
98499b8c6b 2011-11-12        kinaba: 		rec(1, y, y[0], y[1], 1);
98499b8c6b 2011-11-12        kinaba: 		return ans;
98499b8c6b 2011-11-12        kinaba: 	}
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: 	void rec(int i, const vector<int>& y, int lo, int hi, int c)
98499b8c6b 2011-11-12        kinaba: 	{
98499b8c6b 2011-11-12        kinaba: 		if( i == y.size() ) {
98499b8c6b 2011-11-12        kinaba: 			if(c>1)
98499b8c6b 2011-11-12        kinaba: 				ans.push_back(c);
98499b8c6b 2011-11-12        kinaba: 			return;
98499b8c6b 2011-11-12        kinaba: 		}
98499b8c6b 2011-11-12        kinaba: 		rec(i+1, y, lo, hi, c);
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: 		if( lo < y[i] && y[i] < hi ) {
98499b8c6b 2011-11-12        kinaba: 			ans.push_back(c+1);
98499b8c6b 2011-11-12        kinaba: 			return;
98499b8c6b 2011-11-12        kinaba: 		}
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: 	}
98499b8c6b 2011-11-12        kinaba: };
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: // BEGIN CUT HERE
98499b8c6b 2011-11-12        kinaba: #include <ctime>
98499b8c6b 2011-11-12        kinaba: double start_time; string timer()
98499b8c6b 2011-11-12        kinaba:  { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
98499b8c6b 2011-11-12        kinaba: template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
98499b8c6b 2011-11-12        kinaba:  { os << "{ ";
98499b8c6b 2011-11-12        kinaba:    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
98499b8c6b 2011-11-12        kinaba:    os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
98499b8c6b 2011-11-12        kinaba: void verify_case(const vector <int>& Expected, const vector <int>& Received) {
98499b8c6b 2011-11-12        kinaba:  bool ok = (Expected == Received);
98499b8c6b 2011-11-12        kinaba:  if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
98499b8c6b 2011-11-12        kinaba:  cerr << "\to: " << Expected << endl << "\tx: " << Received << endl; } }
98499b8c6b 2011-11-12        kinaba: #define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
98499b8c6b 2011-11-12        kinaba: #define END	 verify_case(_, PointErasing().getOutcomes(y));}
98499b8c6b 2011-11-12        kinaba: int main(){
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: CASE(0)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 1, 2, 1, 1, 0, 4, 3 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {4, 6 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(1)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 0, 0, 4, 4, 8, 8, 4, 4 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {6 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(2)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 522 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {1 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(3)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 19, 19, 19, 19, 19, 19 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {6 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(4)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 0, 1, 2, 3, 4 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {2 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(5)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 7, 8, 8, 7, 6, 7, 9, 3, 5, 0 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {3, 4, 5 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(6)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 3, 2, 3, 3, 4, 3, 4, 3, 3, 1, 5, 3 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {4, 5, 6, 7, 9 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(7)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = { 5, 5, 4, 4, 5, 8, 5, 5, 5, 5, 5, 9, 2, 0, 9, 4, 5, 5, 3, 4, 4, 4, 4, 7, 4 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = {6, 7, 8, 10, 11, 12, 13, 15, 16, 17 };
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(8)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = ;
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = ;
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: CASE(9)
98499b8c6b 2011-11-12        kinaba: 	int y_[] = ;
98499b8c6b 2011-11-12        kinaba: 	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
98499b8c6b 2011-11-12        kinaba: 	int __[] = ;
98499b8c6b 2011-11-12        kinaba: 	  vector <int> _(__, __+sizeof(__)/sizeof(*__));
98499b8c6b 2011-11-12        kinaba: END
98499b8c6b 2011-11-12        kinaba: 
98499b8c6b 2011-11-12        kinaba: }
98499b8c6b 2011-11-12        kinaba: // END CUT HERE