Showing posts with label Big Integer. Show all posts
Showing posts with label Big Integer. Show all posts

Monday, December 21, 2015

Codeforces Education Round 1 C. Nearest Vectors

Problem Statement:
http://codeforces.com/contest/598/problem/C

Solution:
[Before you read any further, I think there is an official editorial for this round which may explain the approach to this problem better.]

The problem looks innocent enough, but actually it is quite a tedious one. Nevertheless, it links several interesting techniques and I find this problem quite interesting eventually.

Saturday, November 15, 2014

UVa 787 - Maximum Sub-sequence

Problem Statement:
787 - Maximum Sub-sequence

Solution:

Interesting DP problem, but the problem requires Big Integer implementation. Anyway the term "subsequence" here actually does not mean what you think it means, in this problem it refers to consecutive sequence of elements. The idea is simply to find an efficient way to calculate all resulting products off any consecutive sequences, which are only 10K of them since there are only 100 elements. This can be done using a DP technique in \(O(N^2)\).