MGSINFOB - Russian Year 5 Problem
Ms. G was looking at her collection of quality Russian year 5 problems when she noticed a pattern: there are always two answers that added up to 100. She assigned this problem to every Maths class at school: given a list of numbers (the answers to the problems), find the index of the two numbers that add up to 100. There will always be a unique solution.
Input
The input contains two lines.
The first line has an integer N (1 ≤ N ≤ 104), the number of answers Ms. G provided you with.
The second line contains an array T of N integers (1 ≤ Ti ≤ 169), the answers to the problems.
Output
Output two integers on two separate lines in order, the two index where the answers sum up to 100.
Example
Input: 3 40 60 29 Output: 1 2
Explanation
40 + 60 = 100, 40 is at index 1, 60 is at index 2
hide comments
|
Simes:
2025-08-28 17:43:09
No comment when I say your test data is wrong? or are you still sure "There will always be a unique solution"? |
|
Simes:
2025-08-24 16:06:27
My validator says your test cases are incorrect as there are some test cases with multiple possible answers.
|
|
Vipul Srivastava:
2025-08-23 18:01:09
Waste of time ! |
|
lalit_nit:
2025-08-23 07:10:54
idk why but my O(nxn) giving WA but after using Hashmap it is giving correct. Tested all test cases both are giving same output.
|
|
bhargavagopal:
2025-08-22 18:51:51
why is it giving WA for a simple O(n^2) solution? Not even TLE, straight up WA where I check in i 0 --> n-1 and j i+1 --> n and im checking ar[i] + ar[j] == 100 and I'm still getting WA when I'm printing i and new line and j. Not even TLE
|
Added by: | OuiOuiBaguette |
Date: | 2025-08-06 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |