Submission #1856932
Source Code Expand
#include <iostream> #include <cstdio> using namespace std; typedef long long ll; ll n, m, a, x, y, t, M = 1e9 + 7, Z = 1e9; int main() { ll i; cin >> n >> m; for (i = 1; i<= n; i++) { scanf("%lld",&a); a = a + Z; x = (x + a * (i - 1)) % M; t = (a * (n - i)) % M; x = (x - t + M) % M; } for (i = 1; i<= m; i++) { scanf("%lld",&a); a = a + Z; y = (y + a * (i - 1)) % M; t = (a * (m - i)) % M; y = (y - t + M) % M; } cout << (x * y) % M; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - ### |
User | sean617 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 506 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&a); ^ ./Main.cpp:19:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&a); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 256 KB |
min.txt | AC | 1 ms | 256 KB |
mod.txt | AC | 15 ms | 256 KB |
n2.txt | AC | 15 ms | 256 KB |
rndA.txt | AC | 29 ms | 256 KB |
rndB.txt | AC | 29 ms | 256 KB |
rndC.txt | AC | 29 ms | 256 KB |
rndD.txt | AC | 29 ms | 256 KB |
rndE.txt | AC | 29 ms | 256 KB |
rndF.txt | AC | 29 ms | 256 KB |
rndG.txt | AC | 29 ms | 256 KB |
rndH.txt | AC | 29 ms | 256 KB |
rndI.txt | AC | 30 ms | 256 KB |
rndJ.txt | AC | 29 ms | 256 KB |
var.txt | AC | 29 ms | 256 KB |