## Police Operation

Roy is helping the police department of his city in crime fighting. Today, they informed him about a new planned operation. Think of the city as a 2D plane. The road along the X-axis is very crime prone, because n criminals live there. No two criminals live at the same position. To catch these criminals, the police department has to recruit some police officers and give each of them USD h as

View Solution →## Zurikela's Graph

Zurikela is creating a graph with a special graph maker. At the begining, it is empty and has no nodes or edges. He can perform 3 types of operations: 1. A x : Create a set of x new nodes and name it set-K. 2. B x y: Create edges between nodes of set-x and set-y. 3. C x : Create a set composed of nodes from set-x and its directly and indirectly connected nodes, called set-K. Note that each no

View Solution →## Modify The Sequence

You are given a sequence of integers a1,a2,a3.....an. You are free to replace any integer with any other positive integer. How many integers must be replaced to make the resulting sequence strictly increasing? Input Format The first line of the test case contains an integer N - the number of entries in the sequence. The next line contains N space separated integers where the ith integer is ai

View Solution →## Longest Mod Path

n the middle of a nightmare, Maxine suddenly finds herself in a mysterious room with the following items: A piece of paper with the word score and the integer written on it. A map of the castle where the room is located. There are rooms uniquely labeled from to . There are bidirectional corridors connecting pairs of rooms. The value of score changes every time she travels up or down a co

View Solution →## P-sequences

We call a sequence of N natural numbers (a1, a2, ..., aN) a P-sequence, if the product of any two adjacent numbers in it is not greater than P. In other words, if a sequence (a1, a2, ..., aN) is a P-sequence, then ai * ai+1 ≤ P ∀ 1 ≤ i < N You are given N and P. Your task is to find the number of such P-sequences of N integers modulo 109+7. Input Format The first line of input consists of

View Solution →