Artifact Content
Not logged in

Artifact 0f9aa2d57aa323913eb0303c83ef257b9ddf1dcc


#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class NumberofFiboCalls { public:
	vector <int> fiboCallsMade(int n) 
	{
		vector<int> z(n+2), o(n+2);
		z[0] = 1;
		o[1] = 1;
		for(int i=2; i<=n; ++i) {
			z[i] = z[i-2] + z[i-1];
			o[i] = o[i-2] + o[i-1];
		}
		vector<int> ans(2);
		ans[0] = z[n];
		ans[1] = o[n];
		return ans;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const vector <int>& Expected, const vector <int>& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: " << Expected << endl << "\tx: " << Received << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, NumberofFiboCalls().fiboCallsMade(n));}
int main(){

CASE(0)
	int n = 0; 
	int __[] = {1, 0 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(1)
	int n = 3; 
	int __[] = {1, 2 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(2)
	int n = 6; 
	int __[] = {5, 8 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(3)
	int n = 22; 
	int __[] = {10946, 17711 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END

}
// END CUT HERE