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 |
必须ac(openjudge题解常客)#include<map> #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N=10010; int c[N]; int d[N]; int n,p,h,m; map<pair<int,int>,bool> existed; int main() { memset(c,0,sizeof c); scanf("%d%d%d%d",&n,&p,&h,&m); for(int i=1;i<=m;i++) { int a,b; scanf("%d%d",&a,&b); if(a>b) swap(a,b); if(existed[make_pair(a,b)]) { continue; } d[a+1]--; d[b]++; existed[make_pair(a,b)]=true; } for(int i=1;i<=n;i++) { c[i]=c[i-1]+d[i]; } for(int i=1;i<=n;i++) { printf("%d\n",h+c[i]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator