-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSUMQ.txt
51 lines (43 loc) · 938 Bytes
/
SUMQ.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
using namespace std;
int main() {
long long t,a[100000],b[100000],c[100000],i,j,k,p,q,r,sum;
const unsigned int M = 1000000007;
cin>>t;
while(t>0)
{
cin>>p>>q>>r;
for(i=0;i<p;i++)
{
cin>>a[i];
}
for(i=0;i<q;i++)
{
cin>>b[i];
}
for(i=0;i<r;i++)
{
cin>>c[i];
}
sum=0;
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
{
for(k=0;k<r;k++)
{
if(b[j]>=a[i] && b[j]>=c[k])
{
sum=(sum+((a[i]+b[j])*(b[j]+c[k])))%M;
}
else
sum=sum+0;
}
}
}
cout<<sum<<"\n";
sum=0;
t--;
}
return 0;
}