Dislaimer: long answer.
Arthur answered your question very nicely, but I'd like to tell you a much more general result that might pique your interest in a field of math called "algebraic geometry". So – if we are working in an algebraically closed field, say the complex numbers $\mathbb{C}$, then every polynomial in one variable splits completely into linear factors. As the other answers say, this is enough to show that one variable complex polynomials are uniquely determined by their roots, up to multiplicity and multiplication by a constant: if the roots of a polynomial $p(t)$ are some complex numbers $\lambda_1,...,\lambda_k\in\mathbb{C}$, then that polynomial must be $\lambda(t-\lambda_1)^{l_1}...(t-\lambda_k)^{l_k}$ for some non-zero complex number $\lambda$ and some non-zero natural numbers $l_1,...l_k$.
However, what happens if we want to consider polynomials in multiple variables? This is a very natural thing if you want to study geometry – for instance, the unit circle in the real plane is cut out by an equation of the form $t_1^2+t_2^2-1=0$. This polynomial has more than one variable, and in general we won't be able to factor such polynomials the same way we can polynomials in one variable. However, we can get a beautiful analog of the one-variable result using some more advanced algebraic machinery.
In particular, there's an important result in commutative algebra called Hilbert's Nullstellensatz, which I won't state in full generality here. But one corollary of it is that, if the roots of a complex polynomial $p(t_1, ..., t_n)\in\mathbb{C}[t_1, ..., t_n]$ are also roots of another complex polynomial $q(t_1, ..., t_n)\in\mathbb{C}[t_1, ..., t_n]$, then there exist a natural number $k$ and a third polynomial $r(t_1, ..., t_n)\in\mathbb{C}[t_1, ..., t_n]$ such that $q^k=rp$. We can use this to prove the following lovely result: if $p(t_1, ..., t_n),q(t_1, ..., t_n)\in\mathbb{C}[t_1, ..., t_n]$ are non-zero and share the same roots, and also have no repeated factors (ie, if a non-constant polynomial $r$ divides $p$, then $r^2$ does not divide $p$, and likewise for $q$), there there is a complex number $\lambda$ such that $p=\lambda q$ – ie, $p$ and $q$ differ by only a scalar multiple, and so a polynomial with no repeated factors is uniquely determined (up to a scalar multiple) by its roots.
I give a proof of this below; you need one other piece of machinery from algebra, which is that any non-constant polynomial in $\mathbb{C}[t_1, ..., t_n]$ has a unique factorization into irreducible polynomials, up to reordering and multiplication by constants. (Recall that an irreducible polynomial is one that has no non-constant divisors other than constant multiples of itself.) The term for this is that $\mathbb{C}[t_1, ..., t_n]$ is a "unique factorization domain" (ufd), which is a much more general phenomenon, but you don't need that here. Given these two facts that I've mentioned, you can prove the result we want. I do this below, but first I recommend trying to prove this yourself!! It's a nice exercise.
Proof: let $p$ and $q$ be as above: non-zero complex polynomials in $n$ variables with no repeated factors and which share the same roots. In particular, the roots of $p$ are also roots of $q$, so by the corollary to the nullstellensatz there is some $k\in\mathbb{N}$ and $r\in\mathbb{C}[t_1,...,t_n]$ such that $q^k=rp$. I claim that we can assume $k=1$. Indeed, because of unique factorization in $\mathbb{C}[t_1, ..., t_n]$, we can write $q=q_1*...*q_m$ for some $m\in\mathbb{N}$, where each $q_i\in\mathbb{C}[t_1,...,t_n]$ is irreducible. Note that, if $i\neq j$, then $q_i\neq \lambda q_j$ for any $\lambda\in\mathbb{C}$, or else $q_i^2$ would divide $q$, contradicting the fact that $q$ has no repeated factors.
Now, the fact that $q^k=rp$ means that $q_1^k...q_m^k=rp$. In particular, $q_i^k$ divides $rp$ for every $i$ – ie $q_i$ (or some scalar multiples of it) appears $k$ times in the unique (up to constant multiples) factorization of $rp$ into irreducible polynomials. But a factorization of $rp$ into irreducible polynomials is the same thing as a factorization of $r$ into irreducibles multiplied with a factorization of $p$ into irreducibles. In particular, this means that – if $l_1$ and $l_2$ are the largest numbers such that $q_i^{l_1}$ divides $r$ and $q_i^{l_2}$ divides $p$ – then $l_1+l_2=k$. (Note that $l_1$ and $l_2$ are not necessarily non-zero.) However, we know that $q_i^l$ does not divide $p$ for any $l>1$, since $p$ has no repeated factors, and so by the pigeonhole principle we must have that $q_i^{k-1}$ divides $r$. In particular, each $q_i$ appears at least $k-1$ times in the factorization of $r$ into irreducibles, so $q^{k-1}=q_1^{k-1}*...*q_m^{k-1}$ divides $r$; say $r=r'q^{k-1}$ for some other other polynomial $r'\in\mathbb{C}[t_1,...,t_n]$.
Putting this together with the fact that $q^k=rp$ gives us $q^k=q^{k-1}r'p$, and dividing out gives $q=r'p$. Now, on the other hand, the roots of $q$ are also roots of $p$, and so we can go through exactly the same arguments as above to show that there is some polynomial $s\in\mathbb{C}[t_1,...,t_n]$ such that $p=sq$. Hence, combining these two equations, $q=r'sq$, and dividing out by $q$ gives $r's=1$. But no non-constant polynomial is invertible, so this means that $r'$ and $s$ are actually constant polynomials – ie complex numbers – and so $\lambda=s\in\mathbb{C}$ gives $p=\lambda q$, exactly the result we desired.
Hopefully this argument was all clear; let me know if there's any confusion on your end. And hopefully this seems like a nice result!! It's a vast generalization of the the question you asked, and shows that some of our intuition for one-variable polynomials carries over very nicely to multi-variable polynomials. In particular, when we want to do some geometry and think about curves defined by multi-variable polynomials, we can use some of the same ideas and tools that we use for one-variable polynomials. These multi-variable polynomials and the curves they cut out are some of the central objects of study in classical algebraic geometry. Now, the algebraic results that we had to use – in particular the nullstellensatz – are non-elementary, and there's a decent amount of algebra you'd have to learn before you could prove it in full generality, but hopefully this gives you some motivation to study some higher math in the future!! It's full of beautiful results like this one.