Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <fstream>
#include <algorithm>
#include <array>
#include <vector>
#include <cassert>
#include <optional>
#include <unordered_map>
#include <numeric>
#include <cmath>
@frcepeda
frcepeda / Robot.md
Last active June 2, 2021 19:41
JOI 2020/2021

Robot

Translated from https://www.ioi-jp.org/joi/2020/2021-ho/2021-ho-t4-review.pdf

Description

  • You are given a simple undirected graph where the edges have colors.
  • When giving instructions to the robot, you can only pick edges such that there's no other edge with the same color adjacent to the node where the robot is.
  • Before giving the robot instructions, you want to paint the edges such that the robot can reach from node 1 to node N.
  • Each edge has a cost associated with it; minimize the total cost of painting the edges.
@frcepeda
frcepeda / set-keyboard-lay-out-dvorak.ps1
Created February 26, 2021 21:22 — forked from DieBauer/set-keyboard-lay-out-dvorak.ps1
Powershell set keyboard lay-out
# run powershell console as admin
$l = Get-WinUserLanguageList
#http://stackoverflow.com/questions/167031/programatically-change-keyboard-to-dvorak
#0409:00010409 = dvorak en-US
#0409:00000409 = qwerty en-US
$l[0].InputMethodTips[0]="0409:00010409"
Set-WinUserLanguageList -LanguageList $l
@frcepeda
frcepeda / aggrcow.cpp
Last active October 30, 2019 17:23
spoj problems bsearch1, aggrcow
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 100010;
int N, C;
int x[maxn];
bool works(int target){

Keybase proof

I hereby claim:

  • I am frcepeda on github.
  • I am frcepeda (https://keybase.io/frcepeda) on keybase.
  • I have a public key whose fingerprint is 3694 AEA2 B4DD 9DFC BAC5 A609 062E FC41 78FB 6E13

To claim this, I am signing this object:

@frcepeda
frcepeda / bot.js
Last active August 8, 2019 05:29
IOI Slack bot
var webhookURL = "https://hooks.slack.com/???";
var channel = "#ioi2019";
var TEAM = "MEX";
var contestants = 327;
var problem_ids = ["t_line", "t_vision", "t_walk"];
var interesting_ids = ["c_Day1"].concat(problem_ids);
var CONTEST_START = DataStore.contest_list[1].begin;
var statusInterval = 15 * 60 * 1000;
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
struct edge {
int n, w, next;
};
@frcepeda
frcepeda / sorts
Last active August 29, 2015 14:06
*** Insertion Sort ***
Sorted:
size comparisons time
1000 999.000000000000000 37461.000000000000000
2000 1999.000000000000000 44549.000000000000000
3000 2999.000000000000000 63145.000000000000000
4000 3999.000000000000000 85351.000000000000000
5000 4999.000000000000000 102863.000000000000000
6000 5999.000000000000000 126167.000000000000000
7000 6999.000000000000000 151501.000000000000000
@frcepeda
frcepeda / IOI Submission History
Last active August 3, 2021 04:40
IOI Submissions History
Taken from CMS. Does anyone have this for previous IOIs?
@frcepeda
frcepeda / skip list con saltos.c
Last active August 29, 2015 13:57
Skip Lists
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#define MAXN 200100
#define MAXL 18
typedef struct {
int key, height;
int next[MAXL], len[MAXL];