File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include < cstdint>
2+
3+ struct Rand {
4+ private:
5+ constexpr static double R = 1.0 / 0xffffffff ;
6+ uint64_t x;
7+
8+ public:
9+ Rand (uint64_t seed = 88172645463325252ull ) : x(seed) {}
10+
11+ inline uint64_t nextULong () { // [0, 2^64)
12+ x ^= x << 7ull ;
13+ x ^= x >> 9ull ;
14+ return x;
15+ }
16+
17+ inline uint32_t nextUInt (uint32_t r) { // [0, r)
18+ return ((nextULong () >> 32ull ) * r) >> 32ull ;
19+ }
20+
21+ inline uint32_t nextUInt (uint32_t l, uint32_t r) { // [l, r)
22+ return l + nextUInt (r - l);
23+ }
24+
25+ inline double nextDouble () { // [0.0, 1.0]
26+ return ((uint32_t )nextULong ()) * R;
27+ }
28+ };
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ bool chmax(Tp& a, const Tp& b) {
108108}
109109
110110#include " /home/tsutaj/Documents/compro/cpp_library/marathon/timer.cpp"
111- #include " /home/tsutaj/Documents/compro/cpp_library/marathon/rand .cpp"
111+ #include " /home/tsutaj/Documents/compro/cpp_library/marathon/rand_xorshift .cpp"
112112Rand rnd (35023503980LL );
113113Timer timer;
114114using Answer = vector<int >; // TODO
@@ -134,5 +134,6 @@ int main() {
134134 timer.setStart ();
135135 input ();
136136 solve ();
137+ fprintf (stderr, " end time = %.3f\n " , timer.getTime ());
137138 return 0 ;
138139}
You can’t perform that action at this time.
0 commit comments