Sponsors

Codeforces Round #379 (Div. 2), problem: (D) Anton and Chess Solution in C

Hey guys I just tried the Anton and Chess problem , hope you might like my solution feel free to comment better solution .

#include
#include
typedef unsigned u;
u F(u a,u b){return(b>=a)+(b>a);}
char C[3][3],c[3];u D[3][3];
int main()
{
u q,x,y,a,b,dx,dy,dz,i,j;
for(i=-1;++i<3;)for(j=-1;++j<3;)D[i][j]=-1u; scanf("%u%u%u",&q,&x,&y); x^=(1u<<31);y^=(1u<<31); while(q--) { scanf("%s%u%u",c,&a,&b); a^=(1u<<31);b^=(1u<<31); dx=a>x?a-x:x-a;
dy=b>y?b-y:y-b;
if(dx!=0&&dy!=0&&dx!=dy)continue;
dz=dx>dy?dx:dy;
if(D[F(x,a)][F(y,b)]>dz)
{
D[F(x,a)][F(y,b)]=dz;
C[F(x,a)][F(y,b)]=*c;
}
}
for(i=-1;++i<3;)for(j=-1;++j<3;)if(C[i][j]) { if( ((i^j)&1)&&(C[i][j]=='R'||C[i][j]=='Q'))q=0; if(!((i^j)&1)&&(C[i][j]=='B'||C[i][j]=='Q'))q=0; } printf(q?"NO\n":"YES\n"); return 0; }

‘Patent BS!’: David Axelrod...

'Patent BS!' David Axelrod Slams Trump's Shutdown Blame Game...

SL Green Realty Corp...

SL Green Realty Corp (SLG) Q3 2025: Strategic Wins...

The Independent’s “Record CO₂...

Debunking the Hype: Why the Recent CO₂ "Surge" Isn't...

China vs the World:...

America Mobilizes Global Allies Against China’s Rare Earth Export...

TiVo Stops Selling DVRs,...

The End of an Era: TiVo Exits Hardware Business...

The end of retirement?...

The End of Traditional Retirement: Securing Income After 60 The...

‘Patent BS!’: David Axelrod Roasts Trump’s Attempts to Blame Shutdown on Dems and Illegal Immigrants

'Patent BS!' David Axelrod Slams Trump's Shutdown Blame Game on X Veteran political strategist and CNN commentator David Axelrod took to X (formerly Twitter) on...

SL Green Realty Corp (SLG) Q3 2025 Earnings Call Highlights: Strategic Acquisitions and Robust …

SL Green Realty Corp (SLG) Q3 2025: Strategic Wins Define Earnings Call SL Green Realty Corp, Manhattan’s largest commercial office landlord, recently released the highlights...

The Independent’s “Record CO₂ Surge” Story: Hype Without Context

Debunking the Hype: Why the Recent CO₂ "Surge" Isn't Just Industrial Emissions Alarmist headlines are a fixture in modern climate reporting, and a recent story...

China vs the World: US expects support from India, other allies in rare earths trade tensions

America Mobilizes Global Allies Against China’s Rare Earth Export Tensions The geopolitical chessboard is shifting once again, this time centered on critical resources. The United...

TiVo Stops Selling DVRs, Exiting the Hardware Business After 26 Years

The End of an Era: TiVo Exits Hardware Business After 26 Years, Stopping DVR Sales A quiet revolution in how Americans watched television began in...

The end of retirement? How smart career planning can secure your income and financial independence after 60

The End of Traditional Retirement: Securing Income After 60 The concept of clocking out permanently at 65 and living solely off savings is quickly becoming...

(no subject)

Navigating Digital Peril: Key Takeaways from the RISKS Digest 34.77 The digital landscape is one of constant innovation, but also persistent peril. For decades, the...

Chicago ICE raids, National Guard troops prompt new school leaflets: ‘Know your rights’

Chicago Schools Distribute ‘Know Your Rights’ Leaflets Amidst Heightened ICE Activity The atmosphere outside Nash Elementary School in Chicago recently felt different. While teachers greeted...

The Future Of Sustainable Innovation In Microplastics And Supply Chain

Revolutionizing Sustainability: How CLEANR and Worldly Axion are Reshaping Industry The push for true sustainability is no longer a niche concern—it is a mandatory requirement...