Skip to content

Instantly share code, notes, and snippets.

View mejibyte's full-sized avatar

Andrés Mejía mejibyte

View GitHub Profile
@mejibyte
mejibyte / 10370.java
Created November 2, 2011 01:08
Solution skeletons for problems in http://contests.factorcomun.org/contests/22
import java.util.*;
class Main {
public static void main(String [] args) {
Scanner cin = new Scanner(System.in);
int T = cin.nextInt();
for (int c = 0; c < T; ++c) {
int n = cin.nextInt();
int a[] = new int[n];
@mejibyte
mejibyte / input.txt
Created November 2, 2011 01:38
Test cases for 579 - ClockHands
11:55
1:55
12:12
1:00
2:00
12:19
12:46
9:00
10:16
7:00
@mejibyte
mejibyte / realizarActividad.md
Created November 11, 2011 21:35
Uninteresting homework.

Parámetros Método RealizarActividad

Tipo de dato Nombre Uso Dónde se puede consultar más sobre él
@mejibyte
mejibyte / gist:1360763
Created November 12, 2011 16:24
Solution to 11367 - Full Tank? from UVa
/*
Accepted
*/
#include <iostream>
#include <climits>
#include <vector>
#include <cstdio>
#include <queue>
//#include <cassert>
@mejibyte
mejibyte / gist:1387873
Created November 23, 2011 04:14
My public RSA key.
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA21RWHrHDVTqFH6kh8hxLQRQJxcYgAWBdFUCoOx1sg9clOatxEVodrLm/L9mzKRTq1PI2QGOF0mNaJRc0YbkBL29NiQbb/CITAU2ge8ciV/YeJUcBfmJBZmkG8U/Q8g3W26F0CmqQXfD+80UQxcPR0gaLxTB291OnRAlVFMjqVkURZLd3jXNxSbbdZVLXl7ux3SfERfwXNiQRkzs0AEyUHrLdkmshYi/WgMRA/XeN2xH59rj6LqGB9XQdjeladWZuHq2LhcXi6TNZhBknWB8KoTehcgbA5Z4Z02V0/38l23Fti9CEXuIohZB4yFTzhGlNlzQgP8qooXYD0EVUylUHdQ== wack-a-mole@mischa
@mejibyte
mejibyte / granica_validator.rb
Created November 30, 2011 01:09
Validator for problem Granica
#!/usr/bin/env ruby
if ARGV.size < 3
puts "Usage: #{__FILE__} <testdata.in> <program.out> <testdata.out>"
exit 1
end
in_file = ARGV[0]
team_file = ARGV[1]
ans_file = ARGV[2]
@mejibyte
mejibyte / bundle.rb
Created December 5, 2011 08:13
Scripts to prepare a contest for DOMjudge
require 'fileutils'
password = ARGV[0]
base = Dir.pwd
Dir.glob("*").select { |f| File.directory?(f) }.each do |dir|
Dir.chdir File.join(base, dir)
unless File.exists?("domjudge-problem.ini")
puts "domjudge-problem.ini not found. Skipping #{dir}."
next
@mejibyte
mejibyte / gist:1452761
Created December 9, 2011 18:42 — forked from anaechavarria/BetterSolution.cpp
Code Forces beta round 97 div 2 Problem D
// Andrés Mejía
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
@mejibyte
mejibyte / gist:1456095
Created December 10, 2011 19:49
Validator for problem Jogurt
#!/usr/bin/env ruby
def wrong_answer(reason)
puts "Wrong Answer: #{reason}"
exit(0)
end
# Checks if array is a permutation of the numbers 1, 2, 3, ..., 2 ** n - 1
def check_permutation(array, n)
valid_permutation = (1..2 ** n - 1).to_a
if array.size != valid_permutation.size
@mejibyte
mejibyte / example.html
Created December 21, 2011 03:52
Example of parsing email addresses using Closure library
<html>
<head>
<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/string/string.js"></script>
<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/format/emailaddress.js"></script>
</head>
<body>
<h1>Parsed addresses</h1>
<script>
var addresses = '[email protected], "Scarlett Johansson" <[email protected]>, <[email protected]>, "Johansson, Scarlett" <[email protected]>';