| Task: | 3SUM |
| Sender: | aalto26gm_007 |
| Submission time: | 2026-10-19 17:04:44 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.04 s | details |
| #2 | WRONG ANSWER | 0.04 s | details |
| #3 | WRONG ANSWER | 0.04 s | details |
| #4 | WRONG ANSWER | 0.04 s | details |
| #5 | WRONG ANSWER | 0.04 s | details |
| #6 | WRONG ANSWER | 0.04 s | details |
| #7 | WRONG ANSWER | 0.04 s | details |
| #8 | WRONG ANSWER | 0.04 s | details |
| #9 | WRONG ANSWER | 0.05 s | details |
| #10 | OUTPUT LIMIT EXCEEDED | 0.00 s | details |
| #11 | WRONG ANSWER | 0.10 s | details |
| #12 | WRONG ANSWER | 0.12 s | details |
| #13 | RUNTIME ERROR | 0.07 s | details |
| #14 | RUNTIME ERROR | 0.07 s | details |
| #15 | RUNTIME ERROR | 0.07 s | details |
| #16 | WRONG ANSWER | 0.12 s | details |
| #17 | WRONG ANSWER | 0.27 s | details |
| #18 | WRONG ANSWER | 0.05 s | details |
| #19 | RUNTIME ERROR | 0.07 s | details |
| #20 | WRONG ANSWER | 0.12 s | details |
| #21 | RUNTIME ERROR | 0.08 s | details |
| #22 | RUNTIME ERROR | 0.07 s | details |
| #23 | WRONG ANSWER | 0.04 s | details |
Code
import sys
from bisect import bisect_left
def main():
data = sys.stdin.buffer.read().split()
n, target = int(data[0]), int(data[1])
if target<=2:
print("IMPOSSIBLE")
exit()
l = list(zip(list(map(int, data[2:])), range(1,n+1)))
print(l)
l.sort()
print(l)
l, indexes = zip(*l)
print(l, indexes)
for i in range(n-2):
remaining = target - l[i]
print(l[i], ", remaining:" , remaining)
if remaining<=0:
print("IMPOSSIBLE")
exit()
c1 = max(bisect_left(l, remaining//2, lo=i+1) -1, i+1)
c2 = c1+1
while True:
print(c1, c2)
lc1 = l[c1]
lc2 = l[c2]
val = l[i]+lc1+lc2
if val == target:
print(l[i], lc1, lc2)
exit()
elif val < target:
c2+=1
if c2==n:
break
else :
c1-=1
if c1 == i:
break
print("IMPOSSIBLE")
main()
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 1 3 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(1, 1)] [(1, 1)] (1,) (1,) IMPOSSIBLE |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 3 5 1 3 2 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(1, 1), (3, 2), (2, 3)] [(1, 1), (2, 3), (3, 2)] (1, 2, 3) (1, 3, 2) 1 , remaining: 4 1 2 ... |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 6 1 3 2 |
| correct output |
|---|
| 1 3 2 |
| user output |
|---|
| [(1, 1), (3, 2), (2, 3)] [(1, 1), (2, 3), (3, 2)] (1, 2, 3) (1, 3, 2) 1 , remaining: 5 1 2 ... |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 3 7 3 2 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(3, 1), (2, 2), (1, 3)] [(1, 3), (2, 2), (3, 1)] (1, 2, 3) (3, 2, 1) 1 , remaining: 6 1 2 ... |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 7 3 2 1 1 2 2 1 1 |
| correct output |
|---|
| 2 3 7 |
| user output |
|---|
| [(2, 1), (1, 2), (1, 3), (2, 4... |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 7 4 1 1 2 2 1 2 1 |
| correct output |
|---|
| 1 2 6 |
| user output |
|---|
| [(1, 1), (1, 2), (2, 3), (2, 4... |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 7 5 1 2 1 2 2 1 1 |
| correct output |
|---|
| 1 2 5 |
| user output |
|---|
| [(1, 1), (2, 2), (1, 3), (2, 4... |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 7 6 2 1 1 1 1 2 2 |
| correct output |
|---|
| 1 6 7 |
| user output |
|---|
| [(2, 1), (1, 2), (1, 3), (1, 4... |
Test 9
Verdict: WRONG ANSWER
| 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 |
|---|
| [(1, 1), (1, 2), (1, 3), (1, 4... |
Test 10
Verdict: OUTPUT LIMIT EXCEEDED
| input |
|---|
| 5000 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 11
Verdict: WRONG ANSWER
| 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 |
|---|
| [(1, 1), (1, 2), (1, 3), (1, 4... |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 5000 919900245 663612758 9075403 585385629 98... |
| correct output |
|---|
| 2787 465 2266 |
| user output |
|---|
| [(663612758, 1), (9075403, 2),... |
Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 999989608 12983 25966 38949 51932 64915 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(12983, 1), (25966, 2), (3894... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 14
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 1000000000 65536 131072 196608 262144 327... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(65536, 1), (131072, 2), (196... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 15
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 642700000 6427 12854 19281 25708 32135 3... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(6427, 1), (12854, 2), (19281... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 16
Verdict: WRONG ANSWER
| input |
|---|
| 5000 919900246 663612758 9075403 585385629 98... |
| correct output |
|---|
| 193 1698 4019 |
| user output |
|---|
| [(663612758, 1), (9075403, 2),... |
Test 17
Verdict: WRONG ANSWER
| input |
|---|
| 5000 919900247 663612758 9075403 585385629 98... |
| correct output |
|---|
| 4258 470 1911 |
| user output |
|---|
| [(663612758, 1), (9075403, 2),... |
Test 18
Verdict: WRONG ANSWER
| 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 |
|---|
| [(6, 1), (6, 2), (6, 3), (6, 4... |
Test 19
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 919900247 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(1, 1), (1, 2), (1, 3), (1, 4... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 20
Verdict: WRONG ANSWER
| input |
|---|
| 4999 919900245 9075403 585385629 987230075 83... |
| correct output |
|---|
| 2786 464 2265 |
| user output |
|---|
| [(9075403, 1), (585385629, 2),... |
Test 21
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 1000000000 261323261 25262018 237798562 3... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(261323261, 1), (25262018, 2)... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 22
Verdict: RUNTIME ERROR
| input |
|---|
| 5000 76305003 1 5088 10175 15262 20349 25436... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(1, 1), (5088, 2), (10175, 3)... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 46, in <module>
main()
File "/box/input/code.py", line 31, in main
lc2 = l[c2]
IndexError: tuple index out of rangeTest 23
Verdict: WRONG ANSWER
| input |
|---|
| 2 6 2 2 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| [(2, 1), (2, 2)] [(2, 1), (2, 2)] (2, 2) (1, 2) IMPOSSIBLE |
