2016多校赛 Teacher Bo(曼哈顿距离)

来源:互联网 发布:苹果电脑怎么用淘宝 编辑:程序博客网 时间:2024/06/05 06:16
</div> <div align=center id=rollword><marqueescrollamount=2width=600scrolldelay=30onMouseOver="javascript:this.stop();"onMouseOut="javascript:this.start();"><bstyle="margin-right:20px"><aclass="hot"href="/viewnotify.php?cid=706&id=3">1009:answer mod 10^9+7,题目中已修改,已加粗。请各位选手注意。</a></b><ahref="/notification.php?cid=706">More...</a></marquee></div><divstyle="width:980px;padding:0;margin:0"><tr><tdalign=center><h1style='color:#1A5CC8;margin-top: 20px'>Teacher Bo</h1><fontface=Arial><b><spanstyle='font-size:12px;color:green'>Time Limit: 4000/2000 MS (Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory Limit: 131072/131072 K (Java/Others)<br>Total Submission(s): 1532&nbsp;&nbsp;&nbsp;&nbsp;Accepted Submission(s): 593<br></span></b></font><br><br><divclass=panel_titlealign=left>Problem Description</div><divclass=panel_content> Teacher BoBo is a geography teacher in the school.One day in his class,he marked $N$ points in the map,the $i$-th point is at $(X_i,Y_i)$.He wonders,whether there is a tetrad $(A,B,C,D)(A&lt;B,C&lt;D,A\neq C or B\neq D)$ such that the manhattan distance between A and B is equal to the manhattan distance between C and D.<br><br> If there exists such tetrad,print &quot;YES&quot;,else print &quot;NO&quot;.</div><divclass=panel_bottom>&nbsp;</div><br><divclass=panel_titlealign=left>Input</div><divclass=panel_content>First line, an integer $T$. There are $T$ test cases.$(T\leq 50)$<br><br> In each test case,the first line contains two intergers, N, M, means the number of points and the range of the coordinates.$(N,M\leq 10^5)$.<br><br> Next N lines, the $i$-th line shows the coordinate of the $i$-th point.$(X_i,Y_i)(0\leq X_i,Y_i\leq M)$.</div><divclass=panel_bottom>&nbsp;</div><br><divclass=panel_titlealign=left>Output</div><divclass=panel_content>$T$ lines, each line is &quot;YES&quot; or &quot;NO&quot;.</div><divclass=panel_bottom>&nbsp;</div><br><divclass=panel_titlealign=left>Sample Input</div><divclass=panel_content><pre><divstyle="word-wrap:break-word;White-space:Pre-wrap;width:inherit;font-family:Courier New,Courier,monospace;white-space:pre;">2 3 10 1 1 2 2 3 3 4 10 8 8 2 3 3 3 4 4</div></pre></div><divclass=panel_bottom>&nbsp;</div><br><divclass=panel_titlealign=left>Sample Output</div><divclass=panel_content><pre><divstyle="word-wrap:break-word;White-space:Pre-wrap;width:inherit;font-family:Courier New,Courier,monospace;white-space:pre;">YES NO</div></pre></div><divclass=panel_bottom>&nbsp;</div><br><centerstyle='font-size:15px;font-family:Arial;font-weight:bold;color:#1A5CC8'><ahref='contest_statistic.php?cid=706&pid=1011'>Statistic</a>&nbsp;|&nbsp;<ahref='contest_submit.php?cid=706&pid=1011'>Submit</a>&nbsp;|&nbsp;<ahref='contest_listtopic.php?cid=706'>Clarifications</a>&nbsp;|&nbsp;<ahref='contest_show.php?cid=706'>Back</A></center><br></td></tr></div>
0 0