Submission #1210149


Source Code Expand

Copy
#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
// Do not use: System.Numerics;

public class Test
{
    public static void Main()
    {
        long MOD = 1;
        for (int i = 0; i < 9; i++)
        {
            MOD *= 10;
        }
        MOD += 7;

        var line0 = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        long n = line0[0];
        long m = line0[1];

        var x_i = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var y_i = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        
        long temp = n - 1;
        long sum = 0;

        long x_sum = 0;
        for (int i = 0; i < n - 1; i++)
        {
            sum = (sum + temp + MOD) % MOD;
            long multiplier = sum;
            //Console.WriteLine(multiplier);
            temp -= 2;

            long length = x_i[i + 1] - x_i[i];

            x_sum = (x_sum + multiplier * length + MOD) % MOD;
        }

        long y_sum = 0;
        temp = m - 1;
        sum = 0;
        for (int i = 0; i < m - 1; i++)
        {
            sum = (sum + temp + MOD) % MOD;
            long multiplier = sum;
            //Console.WriteLine(multiplier);
            temp -= 2;

            long length = y_i[i + 1] - y_i[i];

            y_sum = (y_sum + multiplier * length + MOD) % MOD;
        }

        long result = (y_sum * x_sum) % MOD;

        Console.WriteLine(result);
    }
}

Submission Info

Submission Time
Task D - ###
User yuinore
Language C# (Mono 4.6.2.0)
Score 500
Code Size 1629 Byte
Status
Exec Time 130 ms
Memory 39328 KB

Judge Result

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 26 ms 13396 KB
0_001.txt 25 ms 11348 KB
max.txt 130 ms 37856 KB
min.txt 24 ms 9300 KB
mod.txt 77 ms 31324 KB
n2.txt 76 ms 25180 KB
rndA.txt 128 ms 35236 KB
rndB.txt 129 ms 35108 KB
rndC.txt 128 ms 35104 KB
rndD.txt 129 ms 39328 KB
rndE.txt 129 ms 39328 KB
rndF.txt 128 ms 35228 KB
rndG.txt 129 ms 35104 KB
rndH.txt 128 ms 35100 KB
rndI.txt 128 ms 35236 KB
rndJ.txt 128 ms 33060 KB
var.txt 128 ms 34868 KB