标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 676 Accepted Submission(s): 220
#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; int Map[500][50][50]; char str[500][40]; char tstr[500][40]; bool ans[500]; int cnt[500]; int main(){ int tt; scanf("%d",&tt); while(tt--){ memset(Map,0,sizeof(Map)); memset(str,0,sizeof(str)); int n; scanf("%d",&n); for(int i=1;i<=n;i++){ getchar(); int k; scanf("%s %d",str[i],&k); for(int j=1;j<=k;j++){ int a,b,c; scanf("%d%d%d",&a,&b,&c); for(int z=b;z<=c;z++){ Map[i][a][z]=1; } } } int q; scanf("%d",&q); for(int i=1;i<=q;i++){ memset(ans,false,sizeof(ans)); memset(cnt,0,sizeof(cnt)); int t,t1,t2; scanf("%d%d%d",&t,&t1,&t2); for(int j=1;j<=n;j++){ for(int k=t1;k<=t2;k++){ if(Map[j][t][k]) ans[j]=true; } } int Count=0; for(int j=1;j<=n;j++){ if(ans[j]) cnt[++Count]=j; } if(Count==0) printf("None\n"); else{ for(int ii=1;ii<Count;ii++){ for(int jj=ii+1;jj<=Count;jj++){ if(strcmp(str[cnt[ii]],str[cnt[jj]])>0){///此步应该特别注意 int temp1=cnt[ii]; cnt[ii]=cnt[jj]; cnt[jj]=temp1; } } } for(int qq=1;qq<=Count;qq++){ printf("%s%c",str[cnt[qq]],qq==Count?‘\n‘:‘ ‘); } } } } return 0; }
HDU 1707 简单模拟 Spring-outing Decision
标签:
原文地址:http://www.cnblogs.com/13224ACMer/p/4669335.html