Contest Duration: - (local time) (100 minutes) Back to Home

Submission #1208674

Source Code Expand

Copy
```#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<map>
#include<set>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;
typedef long long LL;

const int N = 100010;
const int mo = 1e+9+7;

int a[N];
int b[N];
int n,m;

int main(){
scanf("%d%d",&n,&m);
fo(i,1,n)scanf("%d",&a[i]);
fo(i,1,m)scanf("%d",&b[i]);
sort(a+1,a+1+n);
sort(b+1,b+1+m);
LL x=0,y=0,tmp=0,ans=0;
fo(i,1,n){
x=((x+1ll*a[i]*(i-1)%mo)%mo+mo-tmp)%mo;
tmp=(tmp+a[i])%mo;
}
tmp=0;
fo(i,1,m){
y=((y+1ll*b[i]*(i-1)%mo)%mo+mo-tmp)%mo;
tmp=(tmp+b[i])%mo;
}
ans=x*y%mo;
printf("%I64d\n",ans);
return 0;
}```

#### Submission Info

Submission Time 2017-04-08 21:18:22+0900 D - ### samjia2000 C++14 (GCC 5.4.1) 500 727 Byte AC 29 ms 1024 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:39:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘LL {aka long long int}’ [-Wformat=]
printf("%I64d\n",ans);
^
./Main.cpp:23:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
^
./Main.cpp:24:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fo(i,1,n)scanf("%d",&a[i]);
^
./Main.cpp:25:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fo(i,1,m)scanf("%d",&b[i]);
^
```

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
 AC × 2
 AC × 17
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, max.txt, min.txt, mod.txt, n2.txt, rndA.txt, rndB.txt, rndC.txt, rndD.txt, rndE.txt, rndF.txt, rndG.txt, rndH.txt, rndI.txt, rndJ.txt, var.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
max.txt AC 29 ms 1024 KB
min.txt AC 1 ms 256 KB
mod.txt AC 15 ms 640 KB
n2.txt AC 15 ms 640 KB
rndA.txt AC 28 ms 1024 KB
rndB.txt AC 28 ms 1024 KB
rndC.txt AC 29 ms 1024 KB
rndD.txt AC 29 ms 1024 KB
rndE.txt AC 29 ms 1024 KB
rndF.txt AC 28 ms 1024 KB
rndG.txt AC 29 ms 1024 KB
rndH.txt AC 29 ms 1024 KB
rndI.txt AC 29 ms 1024 KB
rndJ.txt AC 29 ms 1024 KB
var.txt AC 28 ms 1024 KB