Submission #1209139


Source Code Expand

Copy
// AtCoder Regular Contest 071
// D - 井井井 / ###

#include <cstdio>
#define MOD ((ll)1e9 + 7)
using namespace std;
typedef long long int ll;


int N, M;
ll ans;

int main() {

  ll x, y;
  ll sx, ssx, sy, ssy;

  scanf("%d%d", &N, &M);
  sx = 0; ssx = 0;
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x);
    sx += x; sx %= MOD;
    ssx += x * (i + 1) - sx + MOD; ssx %= MOD;
  }
  ans = 0; sy = 0;
  for (int k = 0; k < M; k++) {
    scanf("%lld", &y);
    sy += y; sy %= MOD;
    ans += ((y * (k + 1) - sy + MOD) % MOD) * ssx % MOD; ans %= MOD;
  }
  printf("%lld\n", ans);

  return 0;

}


Submission Info

Submission Time
Task D - ###
User scarlet7000
Language C++14 (GCC 5.4.1)
Score 500
Code Size 641 Byte
Status
Exec Time 24 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &N, &M);
                        ^
./Main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &x);
                      ^
./Main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &y);
                      ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 500 / 500 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 0 ms 128 KB
0_001.txt 1 ms 128 KB
max.txt 24 ms 128 KB
min.txt 0 ms 128 KB
mod.txt 12 ms 128 KB
n2.txt 12 ms 128 KB
rndA.txt 24 ms 128 KB
rndB.txt 24 ms 128 KB
rndC.txt 24 ms 128 KB
rndD.txt 24 ms 128 KB
rndE.txt 23 ms 128 KB
rndF.txt 23 ms 128 KB
rndG.txt 23 ms 128 KB
rndH.txt 24 ms 128 KB
rndI.txt 24 ms 128 KB
rndJ.txt 24 ms 128 KB
var.txt 23 ms 128 KB