The company reported a loss of $331 million for the quarter, compared with a profit of $18 million a year ago.