Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
from random import *
def rand_coord():
return randint(0, coord_max)
def rand_pt():
print(rand_coord(), rand_coord(),
randint(0, val_max))
@zxytim
zxytim / gist:4351091
Created December 21, 2012 06:45
A template for fast read of integer and string for c++.
/*
* $File: fast-read.cc
* $Date: Fri Dec 21 14:44:05 2012 +0800
* $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
*
* A template for fast read of integer and string.
*
* This implementation is in MACRO format because it
* yields a slightly faster code that that of using
* function calls.
#include <sys/time.h>
#include <cmath>
#include <cstdio>
typedef unsigned long long time_ms_t;
time_ms_t get_time()
{
static timeval tv;
gettimeofday(&tv, 0);
return tv.tv_sec * 1000 + tv.tv_usec * 0.001;
/**************************************************************
Problem: 1969
User: zxytim
Language: C++
Result: Accepted
Time:654 ms
Memory:7568 kb
****************************************************************/
/*