주어진 연립 일차 방정식을 행렬 방정식으로 표현하고, 해를 구하면 다음과 같다.
문제에서 해 (x, y)가 유일하게 존재한다고 했으므로, 행렬식(a e - b d)이 0인 경우(해가 없거나 무수히 많은 경우)는 고려하지 않아도 된다.

import sys
a, b, c, d, e, f = map(int, sys.stdin.readline().split())
x = (c * e - b * f) // (a * e - b * d)
y = (a * f - c * d) // (a * e - b * d)
print(x, y)
2중 for 문을 쓰더라도 최대 999 * 999번의 연산이 이뤄지므로, 주어진 시간 내에 풀 수 있다.
import sys
# find_solution: 방정식의 해를 구하는 함수
def find_solution(a, b, c, d, e, f):
for x in range(-999, 1000):
for y in range(-999, 1000):
if a * x + b * y == c and d * x + e * y == f:
return (x, y)
# 입력
a, b, c, d, e, f = map(int, sys.stdin.readline().split())
# 출력
solution = find_solution(a, b, c, d, e, f)
print(*solution)