0% found this document useful (0 votes)
2 views7 pages

A - The 'Not My Job' Deployment: Input Format

The document outlines multiple programming problems, each with specific input and output requirements. Problems include identifying failure points in microservices, maximizing pizza slice availability during a hackathon, resolving developer queries based on severity, and calculating network gossip connections among employees. Each problem has constraints and sample inputs/outputs to guide implementation.

Uploaded by

abeingbeyond15
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)
2 views7 pages

A - The 'Not My Job' Deployment: Input Format

The document outlines multiple programming problems, each with specific input and output requirements. Problems include identifying failure points in microservices, maximizing pizza slice availability during a hackathon, resolving developer queries based on severity, and calculating network gossip connections among employees. Each problem has constraints and sample inputs/outputs to guide implementation.

Uploaded by

abeingbeyond15
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

A - The 'Not My Job' Deployment

Time Limit: 1.0s | Memory Limit: 256 MB

A catastrophic bug has made it into the production environment, and the blame game has
officially begun. The backend architecture consists of a linear chain of N microservices,
numbered sequentially from 1 to N. The data flow is strictly linear: Service i+1 relies entirely on
the output of Service i.

You have verified that Service 1 (the entry point) is functioning perfectly, but Service N (the user-
facing API) is returning 500 Internal Server Errors. Because error handling was considered 'out
of scope' for the MVP, once a service fails internally, all downstream services will subsequently
fail when they attempt to call it.

You can query any service X in the chain to check its internal logs, which will return either PASS
or FAIL. To minimize AWS CloudWatch billing costs, what is the absolute minimum number of log
queries required in the worst-case scenario to pinpoint the exact microservice where the failure
originated?

Input Format

A single line containing an integer N (2 ≤ N ≤ 1018).

Output Format

Output a single integer representing the worst-case number of log queries required.

Sample Input Sample Output

100 7

1
B - The Free Food Radar
Time Limit: 1.5s | Memory Limit: 256 MB

You are attempting to survive a grueling D-hour collegiate hackathon entirely on a diet of
complimentary corporate catering. There are Q different tech sponsors setting up booths and
bringing free food to bribe students into giving them resumes.

Sponsor i will start distributing pizza at hour Li, will pack up their booth at hour Ri (inclusive), and
is guaranteed to drop exactly Mi slices of pizza per hour onto the communal tables during that
timeframe.

To optimize your caloric intake, you need to know when the venue will reach its maximum food
density. Write a program to calculate the maximum number of pizza slices that will be actively
distributed during any single hour of the hackathon.

Input Format

The first line contains D and Q (1 ≤ D ≤ 106, 1 ≤ Q ≤ 105). The next Q lines contain Li, Ri, and
Mi.

Output Format

Output a single integer: the peak pizza slice availability.

Sample Input Sample Output

5 3 45
1 3 10
2 5 20
3 4 15

2
C - The 'Quick Question' Queue
Time Limit: 2.0s | Memory Limit: 256 MB

You are the sole Senior Developer in an office full of recently graduated boot-campers. Over the
course of T minutes, your focus is constantly interrupted. Events occur in two ways.

First, a junior developer might approach your desk and utter the dreaded phrase, 'Hey, quick
question!' carrying an issue with a panic severity level of S. Second, you might finish your current
cup of Chai and decide you finally have the mental fortitude to help someone.

When you finish your Chai (2), you always choose to resolve the issue with the absolute highest
severity level currently waiting at your desk. If multiple developers are panicking at the exact
same severity level, you help whoever has been standing there the longest. Output the severity
of the issues as you resolve them.

Input Format

The first line contains N operations (1 ≤ N ≤ 105). The next N lines are either 1 S (new junior dev
with severity S) or 2 (finish Chai, resolve issue).

Output Format

For every 2 operation, print the severity of the resolved panic. If no one is at your desk, print
CHILL.

Sample Input Sample Output

5 50
1 10 10
1 50 CHILL
2
2
2

3
D - Database Sharding
Time Limit: 2.0s | Memory Limit: 256 MB

The Lead Database Administrator has decided that traditional load balancing is boring. Instead,
they have implemented a custom sharding algorithm based on bitwise operations.

You are provided with an array of N integers, representing the unique cryptographic IDs of the
available database servers in the cluster. Throughout the day, the DBA issues Q routing queries.
For each query, a data packet arrives with an integer payload X. To determine which server
receives the packet, you must find a server ID Y from the available array such that the bitwise
XOR operation (X ⊕ Y) produces the maximum possible value.

Your task is to process all Q payloads and output the maximized XOR value for each, ensuring
the traffic is distributed according to the DBA's chaotic design.

Input Format

The first line contains N and Q (1 ≤ N, Q ≤ 105). The second line contains N integers. The next
Q lines each contain an integer X.

Output Format

For each query, output the maximum possible XOR value on a new line.

Sample Input Sample Output

3 2 13
3 8 2 15
5
7

4
E - The Office Gossip Network
Time Limit: 1.5s | Memory Limit: 256 MB

Knowledge is power, and in this corporation, gossip is the fastest data transmission protocol. You
are secretly mapping the informal communication network of the company's N employees.

Over the fiscal quarter, you observe Q events. An event of type 1 U V indicates that Employee U
and Employee V have started eating lunch together, forming a bidirectional, permanent gossip
link.

An event of type 2 U V is a hypothetical query: if Employee U were to discover highly classified


information about upcoming layoffs, would Employee V eventually hear the rumor through any
connected chain of lunch buddies? Process the timeline of events and answer all queries
accurately.

Input Format

The first line contains N and Q (1 ≤ N ≤ 105, 1 ≤ Q ≤ 2 × 105). The next Q lines contain queries
of type 1 or 2.

Output Format

For each type 2 query, output YES or NO on a new line.

Sample Input Sample Output

4 3 YES
1 1 2
1 2 3
2 1 3

5
F - The Desktop Icon Avalanche
Time Limit: 2.5s | Memory Limit: 256 MB

The Vice President of Sales has an organizational system that terrifies the IT department: he
saves absolutely every downloaded file directly to his Desktop. Currently, there are N rectangular
file icons piled up, overlapping chaotically on his screen.

Each file icon is defined by the Cartesian coordinates of its bottom-left corner (X1, Y1) and its
top-right corner (X2, Y2).

The IT department needs to know exactly how much screen real estate has been lost to this
madness. Calculate the total visible area covered by at least one file icon. Keep in mind that
overlapping regions should only be counted once.

Input Format

The first line contains N (1 ≤ N ≤ 104). The next N lines contain X1 Y1 X2 Y2.

Output Format

Output a single integer representing the total area covered.

Sample Input Sample Output

2 7
0 0 2 2
1 1 3 3

6
G - The Infinite Redirect Loop
Time Limit: 2.0s | Memory Limit: 256 MB

A deeply flawed microservice architecture consists of N distinct nodes connected by M


directional API calls. Because the original architect left the company without writing
documentation or proper error handling, a unique failure protocol exists: if a request fails at node
U, it doesn't return a 500 error; instead, it is blindly forwarded to a randomly chosen adjacent
node.

You need to determine exactly how many valid forwarding paths of exactly length K exist that
start at the API Gateway (Node 1) and miraculously terminate at the Database (Node N).

Because K can be astronomically large, and the number of paths grows exponentially, return
your final answer modulo 109+7.

Input Format

The first line contains N, M, K (2 ≤ N ≤ 100, 1 ≤ M ≤ 500, 1 ≤ K ≤ 1018). The next M lines denote
directed edges.

Output Format

Output the total paths modulo 109+7.

Sample Input Sample Output

3 3 2 1
1 2
2 3
1 3

You might also like