首页 > 其他 > 详细

cf 757C. Felicity is Coming!

时间:2017-01-14 09:26:09      阅读:655      评论:0      收藏:0      [点我收藏+]

这个题还是比较劲的(题意太神了),才知道vector还可以==和排序,扒题解大法好!!

 1 #include<bits/stdc++.h>
 2 #define lowbit(x) x&(-x) 
 3 #define LL long long 
 4 #define N 200005
 5 #define M 1000005
 6 #define mod 1000000007LL
 7 #define inf 0x7ffffffff
 8 using namespace std;
 9 inline int ra()
10 {
11     int x=0,f=1; char ch=getchar();
12     while (ch<0 || ch>9){if (ch==-) f=-1; ch=getchar();}
13     while (ch>=0 && ch<=9){x=x*10+ch-0; ch=getchar();}
14     return x*f;
15 }
16 vector<int> a[M];
17 int main()
18 {
19     int n=ra(),m=ra();
20     for (int i=1; i<=n; i++)
21     {
22         int num=ra();
23         while (num--)
24         {
25             int x=ra();
26             a[x].push_back(i);
27         }
28     }
29     sort(a+1,a+m+1);
30     LL ans=1,f=1;
31     for (int i=2; i<=m; i++)
32         if (a[i]==a[i-1])
33         {
34             f++;
35             ans=(ans*f)%mod;
36         }
37         else f=1;
38     cout<<ans;
39     return 0;
40 }

 

cf 757C. Felicity is Coming!

原文:http://www.cnblogs.com/ccd2333/p/6284647.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!