Skip to content

Instantly share code, notes, and snippets.

/**************************************************************
Problem: 1969
User: zxytim
Language: C++
Result: Accepted
Time:654 ms
Memory:7568 kb
****************************************************************/
/*
#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;
@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.
#!/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))
/*
* $File: class_uniq_thread_job_pool.hh
* $Date: Sat Jan 18 14:33:53 2014 +0800
* $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
*/
#pragma once
#include <vector>
#include <queue>
@zxytim
zxytim / a.cc
Last active August 29, 2015 14:05
strange behavior of auto type deduction in c++14
/*
$ g++ a.cc -o a -std=c++1y
$ ./a
3.1
3.1
3
3.1
3
3.1
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# $File: prefetch.py
# $Date: Tue Aug 26 18:12:01 2014 +0800
# $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
from multiprocessing import Pool
from collections import deque
//#include "opencv_traits.hh"
#include <opencv2/core/core.hpp>
#include <set>
#include <tuple>
#include <map>
#include <vector>
struct Value {
//#include "opencv_traits.hh"
#include <opencv2/core/core.hpp>
#include <set>
#include <tuple>
#include <map>
#include <vector>
template <typename value_t>
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# $File: push-phone
# $Date: Thu Sep 18 11:29:13 2014 +0800
# $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
import sys
import getpass
import socket
import argparse