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<iostream> using namespace std; typedef struct point{ int x; int y; }point; point p[102]; point q[102]; int max(int i,int j) { if(i>j) return i; else return j; } int min(int i,int j) { if(i>j) return j; else return i; } int main() { int testcase; int begin,end; int temp; int i,j,n,k; int Kmax[102]; cin>>testcase; while(testcase--) { scanf("%d%d",&n,&k); for(i=0;i<=101;i++) { Kmax[i]=0; } for(i=0;i<n;i++) { scanf("%d%d%d%d",&p[i].x,&p[i].y,&q[i].x,&q[i].y); begin=min(p[i].x,q[i].x); end=max(p[i].x,q[i].x); for(j=begin;j<=end;j++) { Kmax[j]++; } } temp=Kmax[0]; for(i=0;i<=101;i++) { if(temp<Kmax[i]) temp=Kmax[i]; } printf("%d\n",temp-k); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator