0% found this document useful (0 votes)
3 views4 pages

Programming Problem Statements

The document presents six programming problem statements involving various scenarios such as determining synergistic scroll pairs, maximizing treasure in a cave system, minimizing travel distances between islands, and optimizing chocolate sharing. Each problem includes input and output formats, detailing the constraints and requirements for solving them. The problems are designed for algorithmic challenges, suitable for competitive programming.

Uploaded by

Shanthi.V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Programming Problem Statements

The document presents six programming problem statements involving various scenarios such as determining synergistic scroll pairs, maximizing treasure in a cave system, minimizing travel distances between islands, and optimizing chocolate sharing. Each problem includes input and output formats, detailing the constraints and requirements for solving them. The problems are designed for algorithmic challenges, suitable for competitive programming.

Uploaded by

Shanthi.V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming Problem Statements

1. Synergistic Scrolls

In the mystical Kingdom of Learnaria, the revered Library of Infinite Knowledge houses n ancient

scrolls. Each scroll contains two distinct types of wisdom:

- Arcane Insights (ai) - cherished by the Grand Archivists for their profound intellectual value.

- Practical Applications (bi) - favored by the People of Learnaria for their real-world utility.

A pair of scrolls (i, j) (i < j) is considered synergistic if: ai + aj > bi + bj.

The King has decreed that the total number of synergistic pairs in the library must be determined.

Input Format:

1. The first line contains an integer n (2 <= n <= 2 x 10^5) - the number of scrolls.

2. The second line contains n integers a1, a2, ..., an (1 <= ai <= 10^9) representing Arcane Insights.

3. The third line contains n integers b1, b2, ..., bn (1 <= bi <= 10^9) representing Practical

Applications.

Output Format:

A single integer representing the total number of synergistic pairs of scrolls.

2. Maximum Treasure in Underground Cave System

Dora explores an underground cave system comprising n chambers connected by m unidirectional

paths. Each chamber contains some amount of treasure. Dora aims to maximize the treasure

collected starting from any chamber.

Input Format:

1. The first line contains two integers n and m (1 <= n <= 10^5, 1 <= m <= 2 x 10^5).
2. The second line contains n integers where the i-th integer ti (1 <= ti <= 10^9) represents the

treasure in chamber i.

3. Each of the next m lines describes a unidirectional connection: u and v (1 <= u, v <= n).

Output Format:

The maximum treasure Dora can collect.

3. Pari and Averi's Island Meeting

In a world of islands and bridges, Pari and Averi want to meet. They aim to minimize their total travel

distance to reach two islands P and Q, such that there exists at least one bridge connecting P and

Q.

Input Format:

1. The first line contains two integers n and m (2 <= n <= 10^5, 1 <= m <= 10^5) - the number of

islands and bridges.

2. The second line contains two integers A and B - the islands where Pari and Averi are currently

located (A != B).

3. The next m lines describe the bridges: u, v, w, where u connects to v with a distance w (1 <= u, v

<= n, 1 <= w <= 10^9).

Output Format:

If no solution exists, print -1. Otherwise, print P and Q.

4. Non-Overlapping Treasure Collection

Luna and Elio want to maximize their treasure collection by exploring two non-overlapping subarrays

of a sequence T.

Input Format:
1. The first line contains an integer n (2 <= n <= 10^5) - the number of chambers.

2. The second line contains n integers T[1], T[2], ..., T[n] (|T[i]| <= 10^9) representing the treasure in

each chamber.

Output Format:

The maximum total treasure Luna and Elio can collect. If no valid configuration exists, print -1.

5. Chocolate Sharing

Brenda shares chocolates from N batches equally between herself and Rosie. She always picks two

batches for the most even distribution.

Input Format:

1. The first line contains N (2 <= N <= 10^8) - the number of batches.

2. The second line contains N integers representing chocolates in each batch.

Output Format:

An integer representing the maximum number of times Brenda can share chocolates equally.

6. Optimized Meeting in Islands

Pari and Averi want to minimize the total travel distance from their current islands A and B to meet at

islands P and Q respectively, connected by a direct bridge.

Input Format:

1. The first line contains two integers n and m (2 <= n <= 10^5, 1 <= m <= 10^5) - the number of

islands and bridges.

2. The second line contains two integers A and B (A != B) - the initial islands of Pari and Averi.

3. The next m lines describe the bridges: u, v, w, where u connects to v with a weight w (1 <= u, v

<= n, 1 <= w <= 10^9).


Output Format:

If no solution exists, print -1. Otherwise, print P and Q.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy