Entries from 2016-01-01 to 1 year

TopCoder SRM 701 SortingSubsets

TopCoder Statistics - Problem Statement This problem is short. Note that we just need to count the count of number's positions to change. We don't care the number of moves we did. So we sort the original array, compare it to the original a…

TopCoder SRM 701 SquareFreeString

TopCoder Statistics - Problem Statement This problem is Easy. Note that write clean and easy-reading code, do not use much tricky. Because it may cause some bugs that can not be found easily. For each substring, compare the first half of t…

Compare two huge directories on Linux

I have a huge document directory in my Linux which I copied from my external hard drive long long ago. My hard disk is almost full on my Linux. So I want to move these files to the external to save more space for my Linux. However, I am no…

Technocup 2017 - Elimination Round 2 C. Road to Cinema

codeforces.com Problem There are N cars, each car's price is C[i] and its fuel tank capacity is V[i]. The road length is S. There are K stations on the road. We must pass the road in T minutes. Fuel is free. Car can drive in two mode: (1) …

Today is my birthday

Today(11/21) is my 24's birthday. It's snowy. Nothing special happens and everything is as usual. Linux Mint 18 Today I install Plasma to the Linux Mint 18, because I chose the Xfce version when I installed Linux Mint 18. This is what I do…

Technocup 2017 - Elimination Round 2 D. Sea Battle

codeforces.com Problem: There are N grid on a row, there are A ships, each ship's length is B. Let an int array Array[N] represents the grids. Array[i] == 0 or Array[i] == 1. Ships can only be placed on 0's. Guess some positions that there…

Codeforces Round #165 (Div. 1) B. Greenhouse Effect

codeforces.com Because Xi < Xi+1, for i in [1, N). The plants are given in order "from left to the right". So all of Xi values are not important in this problem. We can discard them. Now the problem is: Given N numbers S[N]. Given a number…

Install MacVim with Lua support

Vim

iI use MacVim on macOS as well as Emacs. In MacVim, I use a plugin called neocomplete: github.com It requires Lua support in Vim. So I reinstall MacVim with Homebrew: brew uninstall macvim brew install macvim --with-lua --with-override-sys…

Install Perl 5.20 on macOS

Codeforces support perl 5.20 and the perl version on macOS is 5.18. So I want to install perl 5.20 on macOS. There is a installation management toll for perl. It is Perlbrew. Just follow the homepage of the Perlbrew to install it: \curl -L…

Reset iTerm2 Preferences to Default

Sometime I mess up my iTerm2 settings and forget where or which configuration I set before. It's annoying to find the exact option I need to reset. It is much easier if I can reset all of the settings to iTerm2's default. So this is the so…