Submission #1210085


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]);
        }
        long distXXX;
        long distYYY;
        long area2 = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                distXXX=(x[j] - x[i]) % ((int)Math.Pow(10, 9) + 7);
                for (int k = 0; k < m - 1; k++) {
                    for (int l = k + 1; l < m; l++) {
                        distYYY=(y[l] - y[k]) % ((int)Math.Pow(10, 9) + 7);
                        area2 += (distXXX * distYYY) % ((int)Math.Pow(10, 9) + 7);
                    }
                }
            }
        }
        area2%=((int)Math.Pow(10, 9) + 7);
        /*
        int conbix = Conbi(n+1);
        //List<long> distXX = new List<long>();
        long[] distX = new long[conbix];
        int countx = 0;
        for (int i = 0; i < n-1; i++) {
            for (int j = i + 1; j < n; j++) {
                //distXX.Add((x[j] - x[i]) % ((int)Math.Pow(10, 9) + 7));
                distX[countx] = (x[j] - x[i]) % ((int)Math.Pow(10, 9) + 7);
                countx++;
            }
        }
        int county = 0;
        int conbiY = Conbi(m+1);
        //List<long> distYY = new List<long>();
        long[] distY = new long[conbiY];
        for (int i = 0; i < m - 1; i++) {
            for (int j = i + 1; j < m; j++) {
                //distYY.Add((y[j] - y[i]) % ((int)Math.Pow(10, 9) + 7));
                distY[county] = (y[j] - y[i]) % ((int)Math.Pow(10, 9) + 7);
                county++;
            }
        }
        long area = 0;
        for (int i = 0; i < countx; i++) {
            for (int j = 0; j < county; 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(area2);

    }

    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 3028 Byte
Status
Exec Time 2109 ms
Memory 35216 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 20 ms 9044 KB
0_001.txt 20 ms 11092 KB
max.txt 2108 ms 28172 KB
min.txt 20 ms 11092 KB
mod.txt 2108 ms 25564 KB
n2.txt 2108 ms 23516 KB
rndA.txt 2108 ms 28036 KB
rndB.txt 2108 ms 35216 KB
rndC.txt 2109 ms 25992 KB
rndD.txt 2109 ms 25988 KB
rndE.txt 2109 ms 30080 KB
rndF.txt 2109 ms 28040 KB
rndG.txt 2108 ms 30080 KB
rndH.txt 2109 ms 25992 KB
rndI.txt 2109 ms 25984 KB
rndJ.txt 2109 ms 25988 KB
var.txt 2109 ms 27936 KB