Submission #1209584


Source Code Expand

Copy
using System;
using System.Collections.Generic;
public class Aprob {
    public static void Main() {
        string[] readSome = new string[2];
        readSome = Console.ReadLine().Split(' ');
        int n = int.Parse(readSome[0]);
        int m = int.Parse(readSome[1]);
        readSome = new string[n];
        readSome = Console.ReadLine().Split(' ');
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = int.Parse(readSome[i]);
        }
        readSome = new string[m];
        readSome = Console.ReadLine().Split(' ');
        int[] y = new int[m];
        for (int i = 0; i < m; i++) {
            y[i] = int.Parse(readSome[i]);
        }
        int conbix = Conbi(n);
        long[] distX = new long[conbix];
        int count = 0;
        for (int i = 0; i < n-1; i++) {
            for (int j = i + 1; j < n; j++) {
                distX[count] = (x[j] - x[i]) % ((int)Math.Pow(10, 9) + 7);
                count++;
            }
        }
        count = 0;
        int conbiY = Conbi(m);
        long[] distY = new long[conbiY];
        for (int i = 0; i < m - 1; i++) {
            for (int j = i + 1; j < m; j++) {
                distY[count] = (y[j] - y[i]) % ((int)Math.Pow(10, 9) + 7);
                count++;
            }
        }
        long area = 0;
        for (int i = 0; i < conbix; i++) {
            for (int j = 0; j < conbiY; j++) {
                //Console.WriteLine(distX[i]+"*"+distY[j]);
                area += (distX[i] * distY[j]) % ((int)Math.Pow(10, 9) + 7);
            }
            area %= ((int)Math.Pow(10, 9) + 7);
        }
        Console.WriteLine(area);

    }

    public static int Conbi(int n) {
        int conbi = 1;
        if (n != 2) {
            for (int i = 1; i <= n; i++) {
                conbi *= i;
            }
            for (int i = 1; i <= n - 2; i++) {
                conbi /= i;
            }
            conbi /= 2;
        } else if (n == 2) {
            conbi = 1;
        } else {
            conbi = 0;
        }
        return conbi;
    }
}

Submission Info

Submission Time
Task D - ###
User shomu36
Language C# (Mono 4.6.2.0)
Score 0
Code Size 2132 Byte
Status
Exec Time 110 ms
Memory 32568 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 0 / 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 21 ms 11092 KB
0_001.txt 20 ms 11092 KB
max.txt 110 ms 32568 KB
min.txt 20 ms 9044 KB
mod.txt 66 ms 29788 KB
n2.txt 66 ms 25820 KB
rndA.txt 108 ms 28292 KB
rndB.txt 108 ms 30340 KB
rndC.txt 108 ms 28292 KB
rndD.txt 108 ms 28296 KB
rndE.txt 107 ms 26240 KB
rndF.txt 108 ms 30344 KB
rndG.txt 107 ms 26240 KB
rndH.txt 108 ms 30212 KB
rndI.txt 107 ms 28288 KB
rndJ.txt 108 ms 28296 KB
var.txt 107 ms 26140 KB