Problem List
| # | Name | Input/Output | Time Limit | Memory Limit | Points |
|---|---|---|---|---|---|
| A | Quick Maths | standard input/output | 1 s | 256 MB | 100 |
| B | Two Sum | standard input/output | 2 s | 512 MB | 150 |
A. Quick Maths
memory limit per test: 256 megabytes
Given two integers \( A \) and \( B \), print their sum.
Input
The first line contains two integers \( A \) and \( B \) \( (0 ≤ A ≤ 100, 0 ≤ B ≤ 100)\).
Output
Print the sum of \( A \) and \( B \).
Example
Input
2 2
Output
4
Input
9 10
Output
19
Explanation
In the first example, 2 + 2 = 4.
B. Two Sum
memory limit per test: 512 megabytes
You are given an array of \( n \) integers and an integer \( t \). Your task is to determine whether there exist two distinct elements in the array such that their sum equals \( t \).
If such a pair exists, output the 1-indexed positions of any such pair. If there are multiple valid answers, output any of them. If no such pair exists, output IMPOSSIBLE.
Input
The first line contains two integers \( n \) and \( t \) \( (2 ≤ n ≤ 10^5, -10^9 ≤ t ≤ 10^9)\).
The second line contains \( n \) integers \( a_1, a_2, ..., a_n \) \((-10^9 ≤ a_i ≤ 10^9)\).
Output
If there exists a pair \( (i,j) (i < j) \) such that \( a_i + a_j = t \), output two integers representing the indices \( i \) and \( j \).
If no such pair exists, output IMPOSSIBLE.
Example
Input
4 9 2 7 11 15
Output
1 2
Help: Standard Input/Output
In programming competitions, problems usually require you to read from standard input and write to standard output.
What is Standard Input?
This is the input your program reads from the console. You don't need to open any files or create a GUI. Just read using language-specific commands like cin (C++) or input() (Python).
What is Standard Output?
This is where your program writes its answers — again, through the console. Use commands like cout (C++) or print() (Python). Make sure the output matches the required format exactly.
Sample Problem:
Given two integers \( A \) and \( B \), print their sum.
Input
3 4
Output
7
Sample Solution Template
In C++
#include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B; // Read two integers
cout << A + B << endl; // Print their sum
return 0;
}
In Python
# Read input, split by space, convert to int A, B = map(int, input().split()) print(A + B)