Both of Great Britain's teams have avoided the reigning world and Olympic champions the USA in the draw for the group stage of London 2012.
Britain's men will face European champions Spain, Australia, Brazil, China and another team to be determined by an additional qualifying tournament.
The women will face Australia, Brazil, European champions Russia and two additional qualifiers in their group.
The top four teams in each group will qualify for the knockout stages.
As such, they could both still meet the US in the latter rounds.
GB performance director Chris Spice told BBC Sport: "The balls have fallen in our favour because we know what we are up against.
"We pushed the boat out for the test event last year and played Australia and China, so that has helped us. We always have tight games against Spain - Brazil remains the unknown but we will do our research on them."
GB captain Andrew Sullivan told BBC Sport: ''I suppose it's as good as what you can hope for at an Olympics, but we are still going to be playing against quality teams. The draw makes no difference if we don't compete as well as we can."
Forward Kieron Achara, who plays professionally in Spain with Manresa, tweeted after the draw: "Not a bad group if you ask me".
Britain's teams were admitted to the Olympics as hosts, following a vote by the International Basketball Federation (known as Fiba) last year.
They were only given permission after satisfying the world governing body that they were competitive at international level and had a legacy plan for the game in the UK.
Both teams have qualified for European championship finals since 2006, the men in 2009 and 2011 and the women in 2011.
GB's men have only previously played in the Olympics in the 1948 London event, while the women's squad, under Australian coach Tom Maher, will be making their debut in London.
Natalie Stafford was enthusiastic about what, at first sight, is a difficult draw. She tweeted: "Russia plus two countries yet to make it! Not a bad one!"
The matches will take place at London's Basketball Hall and the O2 Arena in Greenwich.
The three additional spots in the men's draw will be filled by an Olympic qualifying tournament to be held in Venezuela in June, where Greece, Macedonia, Lithuania, Russia, New Zealand, Angola, Nigeria, Jordan, South Korea, Puerto Rico, Venezuela and Dominican Republic will be in action.
The women's qualifying tournament, to be held in Turkey, offers five additional places with Croatia, Czech Republic, France, Turkey, New Zealand, Mali, Mozambique, Japan, South Korea, Canada, Argentina and Puerto Rico taking part.