Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
why wa?#include<stdio.h> int main() { int n,m,i,t,sum,max,min,kaitou[50001],a,b,x,flag; while(scanf("%d %d",&n,&m)==2) { for(i=1;i<=n;i++) kaitou[i]=0; for(i=1;i<=m;i++) { scanf("%d %d",&a,&b); if(b>kaitou[a])kaitou[a]=b; } sum=0; x=0; for(min=1;min<n;) { max=min; for(i=x+1;i<=min;i++) { if(kaitou[i]>max) max=kaitou[i]; } sum++; x=min; min=max; } printf("%d\n",sum); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator