标签:problem algo eps search groups scan tle ack oid
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<iostream> #include<cstdio> #include<cmath> #include<string> #include<queue> #include<algorithm> #include<stack> #include<cstring> #include<vector> #include<list> #include<bitset> #include<set> #include<map> #include<time.h> using namespace std; #define LL long long #define bug(x) cout<<"bug"<<x<<endl; const int N=5e4+10,M=1e5+10,inf=1e9+10; const LL INF=1e18+10,mod=1e9+7; const double eps=(1e-8),pi=(4*atan(1.0)); int si[10]; int a[6][310]; struct handhash { const static int side=1e5+7; vector<int>v[M]; vector<int>nu[M]; void init() { for(int i=0;i<side;i++) v[i].clear(),nu[i].clear(); } void add(int x) { int z=(abs(x))%side; for(int i=0;i<v[z].size();i++) if(v[z][i]==x) { nu[z][i]++; return; } v[z].push_back(x); nu[z].push_back(1); } int query(int x) { int z=(abs(x))%side; for(int i=0;i<v[z].size();i++) if(v[z][i]==x)return nu[z][i]; return 0; } }mp; int main() { int T; scanf("%d",&T); while(T--) { mp.init(); for(int i=1;i<=5;i++) { scanf("%d",&si[i]); for(int j=1;j<=si[i];j++) scanf("%d",&a[i][j]); } for(int i=1;i<=si[1];i++) for(int j=1;j<=si[2];j++) mp.add(a[1][i]+a[2][j]); LL ans=0; for(int k=1;k<=si[3];k++) for(int i=1;i<=si[4];i++) for(int j=1;j<=si[5];j++) ans+=mp.query(-a[3][k]-a[4][i]-a[5][j]); printf("%lld\n",ans%mod); } return 0; }
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1055 Accepted Submission(s): 312
标签:problem algo eps search groups scan tle ack oid
原文地址:http://www.cnblogs.com/jhz033/p/7608851.html