Solving SDPs for synchronization and MaxCut problems via the Grothendieck inequality