This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <regex> | |
#include <boost/lexical_cast.hpp> | |
using namespace std; | |
vector<string> split(string const& src, string const& separator) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -stdlib=libc++ -std=c++1y raswi.cpp | |
#include <vector> | |
#include <string> | |
#include <numeric> | |
#include <iostream> | |
#include <functional> | |
#include <unordered_map> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <cassert> | |
#include <sstream> | |
using namespace std; | |
enum color { Red = 0, Green, Blue, }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <set> | |
#include <string> | |
#include <vector> | |
#include <cassert> | |
using namespace std; | |
typedef pair<int, int> point_t; | |
typedef vector<vector<string>> board_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package yhpg | |
import scala.math.BigInt | |
object Main extends App { | |
def makeStream(from: BigInt): Stream[BigInt] = from #:: makeStream(from + 1) | |
def isSquare(n: BigInt): Boolean = Math.pow(Math.round(Math.sqrt(n.toDouble)), 2) == n | |
def isCubic(n: BigInt): Boolean = Math.pow(Math.round(Math.cbrt(n.toDouble)), 3) == n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
const int size = 1100; | |
vector<int> sqrt_nums(const vector<bool> &v, int to) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <climits> | |
using namespace std; | |
constexpr int FIELD_SIZE = 5; | |
int field[FIELD_SIZE][FIELD_SIZE]; | |
int memo[10][FIELD_SIZE][FIELD_SIZE]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <queue> | |
#include <vector> | |
#include <map> | |
#include <algorithm> | |
using namespace std; | |
typedef vector<vector<char>> field_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable._ | |
object Problem | |
{ | |
private def format(m: Map[String, Array[Int]]): String = { | |
val keys = m.keys.toArray.sorted | |
( for(key <- keys) yield key + "_" + m.get(key).get.sorted.mkString(":") ).mkString("|") | |
} | |
private def solve(a: Array[String], m: Map[String, Array[Int]]): String = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore'); | |
function toInt(src) { | |
return parseInt(src, 10); | |
} | |
function getSchedules(src) { | |
var schedules = {}; | |
_.each(src.split(','), function(e) { | |
if( _.isUndefined(schedules[e[0]]) ) { |