Codeforces: B. Squares


The problem is from codeforces: http://codeforces.com/contest/263/problem/B
263B Codeforces: B. Squares beginner codeforces geometry implementation math programming languages python tricks Sort the squares by sizes then we will easily derive the answer. If there is a point in the smallest square, it must be in the rest of squares. We can pick one of the four corners of the square as the answer.

#!/usr/bin/env python

n, k = map(int, raw_input().split())
a = map(int, raw_input().split())

if k > n:
    print -1
else:
    a.sort()
    print a[n - k], 0

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
157 words
Last Post: Codeforces: A. Beautiful Matrix
Next Post: Solve the Knight Tour in Python (Breadth First Search Algorithm)

The Permanent URL is: Codeforces: B. Squares

Leave a Reply