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 |
大牛给组测试数据呗~~~悲剧的WA了#include<cstdio> #include<cstring> #include<vector> using namespace std; int main() { int n , d , k , temp , t[2000] , data[2000] , now , o , j , total = 0 , l; scanf("%d %d %d" , &n , &d , &k); memset(t , 0 , sizeof t); memset(data , 0 , sizeof data); for(temp = 0; temp < k ; temp++) t[temp] = 1; now = 0; do { for(temp = 0; temp < k; temp++) if(t[temp]) data[now] |= (1 << temp); else data[now] &= ~(1 << temp); now++; }while(prev_permutation(t , t + k + 1)); for(temp = 0 ; temp < n; temp++) { scanf("%d" , &l); if(l > k) { int u; while(l--) scanf("%d" , &u); continue; } memset(t , 0 , sizeof t); for(o = 0; o < l; o++) { scanf("%d" , &j); t[j - 1] = 1; } for(o = j = 0; o < d; o++) if(t[o]) j |= (1 << o); else j &= ~(1 << o); for(o = 0 ; o < now; o++) if(data[o] == (j | data[o])) break; if(o != now || !l) total++; } printf("%d\n" , total); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator