Artifact Content
Not logged in

Artifact b7f0b3a8ec81231036bf231e7b933152b65fd1a7


#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;

static const LL MODVAL =  1000000007;
class CarrotJumping { public:
	int theJump(int init) 
	{
		LL x = (init+1) % MODVAL;
		int i = 2;
		x = (x*4) % MODVAL;
		while(i < 1000000){
			if( x == 1 ) {
				int z = i/3 + (i%3 ? 1 : 0);
				return z>100000 ? -1 : z;
			}
			i++;
			x = (x*2)% MODVAL;
		}
		return -1;
	}
};

// 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 int& Expected, const 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(_, CarrotJumping().theJump(init));}
int main(){

CASE(0)
	int init = 125000000; 
	int _ = 1; 
END
CASE(1)
	int init = 281250001; 
	int _ = 2; 
END
CASE(2)
	int init = 18426114; 
	int _ = 58; 
END
CASE(3)
	int init = 4530664; 
	int _ = 478; 
END
CASE(4)
	int init = 705616876; 
	int _ = 100000; 
END
CASE(5)
	int init = 852808441; 
	int _ = -1; 
END
CASE(6)
	int init = 1; 
	int _ = -2; 
END
CASE(7)
	int init = 1000000006; 
	int _ = -2; 
END

}
// END CUT HERE