Submission details
Task:3SUM
Sender:francden
Submission time:2025-10-20 17:33:40 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#20.07 sdetails
#30.06 sdetails
#40.06 sdetails
#50.07 sdetails
#60.06 sdetails
#70.06 sdetails
#80.06 sdetails
#90.07 sdetails
#100.07 sdetails
#110.07 sdetails
#120.08 sdetails
#130.07 sdetails
#140.07 sdetails
#150.07 sdetails
#160.08 sdetails
#170.08 sdetails
#180.07 sdetails
#190.07 sdetails
#200.08 sdetails
#210.08 sdetails
#220.07 sdetails
#230.06 sdetails

Code

n,target = [int(x) for x in input().split()]


numbers = [(val, i + 1) for i, val in enumerate(input().split())]

numbers.sort()  

for i in range(n):
    targets = {} 

    for j in range(i+1, n):
        new_target = target-numbers[j][0]-numbers[i][0]
        if new_target in targets:
            print(numbers[i][1], targets[new_target], numbers[j][1])
            exit()
        targets[numbers[j][0]] = numbers[j][1]

print("IMPOSSIBLE")

Test details

Test 1

Verdict: ACCEPTED

input
1 3
1

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Test 2

Verdict:

input
3 5
1 3 2

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 3

Verdict:

input
3 6
1 3 2

correct output
1 3 2

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 4

Verdict:

input
3 7
3 2 1

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 5

Verdict:

input
7 3
2 1 1 2 2 1 1

correct output
2 3 7

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 6

Verdict:

input
7 4
1 1 2 2 1 2 1

correct output
1 2 6

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 7

Verdict:

input
7 5
1 2 1 2 2 1 1

correct output
1 2 5

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 8

Verdict:

input
7 6
2 1 1 1 1 2 2

correct output
1 6 7

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 9

Verdict:

input
5000 3
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
1 2 5000

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 10

Verdict:

input
5000 4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 11

Verdict:

input
5000 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
714 3518 4240

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 12

Verdict:

input
5000 919900245
663612758 9075403 585385629 98...

correct output
2787 465 2266

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 13

Verdict:

input
5000 999989608
12983 25966 38949 51932 64915 ...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 14

Verdict:

input
5000 1000000000
65536 131072 196608 262144 327...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 15

Verdict:

input
5000 642700000
6427 12854 19281 25708 32135 3...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 16

Verdict:

input
5000 919900246
663612758 9075403 585385629 98...

correct output
193 1698 4019

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 17

Verdict:

input
5000 919900247
663612758 9075403 585385629 98...

correct output
4258 470 1911

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 18

Verdict:

input
5000 6
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...

correct output
4998 4999 5000

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 19

Verdict:

input
5000 919900247
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 20

Verdict:

input
4999 919900245
9075403 585385629 987230075 83...

correct output
2786 464 2265

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 21

Verdict:

input
5000 1000000000
261323261 25262018 237798562 3...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 22

Verdict:

input
5000 76305003
1 5088 10175 15262 20349 25436...

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'

Test 23

Verdict:

input
2 6
2 2

correct output
IMPOSSIBLE

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 12, in <module>
    new_target = target-numbers[j][0]-numbers[i][0]
TypeError: unsupported operand type(s) for -: 'int' and 'str'