Submission #835103
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; class Myon { public Myon() { } public static int Main() { new Myon().calc(); return 0; } long mod = 1000000007; void calc() { string[] st; st = splitLine(2, 2); int R = getInt(st[0], 1, 30); int C = getInt(st[1], 1, 30); st = splitLine(2, 2); int X = getInt(st[0], 1, R); int Y = getInt(st[1], 1, C); st = splitLine(2, 2); int D = getInt(st[0], 0, X * Y); int L = getInt(st[1], 0, X * Y); int DL = D + L; if (DL > X * Y) myon("over DL"); setC(1000); long ret = 0; long[,] need = new long[X + 1, Y + 1]; need[X, Y] = 1; for (int i = X; i >= 0; i--) { for (int j = Y; j >= 0; j--) { long mul = need[i, j]; long tret = mul; while (tret < 0) tret += mod; //Console.WriteLine(i + " " + j + " " + check(tret)); tret *= getC(i * j, DL); tret %= mod; tret *= getC(DL, D); tret %= mod; ret = (tret + ret) % mod; for (int k = 1; k <= i; k++) { for (int l = 1; l <= j; l++) { if (k == i && l == j) continue; need[k, l] -= (i - k + 1) * (j - l + 1) * mul; need[k, l] %= mod; } } } } ret *= (R - X + 1) * (C - Y + 1); ret %= mod; Console.WriteLine(ret); } long check(long a) { if (a < mod / 2) return a; return a - mod; } long[,] C; void setC(int N) { C = new long[N, N]; for (int i = 0; i < N; i++) { C[i, 0] = 1; for (int j = 1; j <= i; j++) { C[i, j] = (C[i - 1, j] + C[i - 1, j - 1]) % mod; } } } long getC(int a, int b) { return C[a, b]; } //swap void swap<T>(ref T a, ref T b) { T c = a; a = b; b = c; } void myon(string s) { throw new Exception(s); } int getInt(string s, int min, int max) { int ret = int.Parse(s); if (ret < min) throw new Exception("low"); if (ret > max) throw new Exception("high"); return ret; } int getIntLine(int min, int max) { int ret = int.Parse(Console.ReadLine()); if (ret < min) throw new Exception("low"); if (ret > max) throw new Exception("high"); return ret; } double getDouble(string s, double min, double max) { double ret = double.Parse(s); if (ret < min) throw new Exception("low"); if (ret > max) throw new Exception("high"); return ret; } double getDoubleLine(double min, double max) { double ret = double.Parse(Console.ReadLine()); if (ret < min) throw new Exception("low"); if (ret > max) throw new Exception("high"); return ret; } string getString(string s, int min, int max) { if (s.Length < min) throw new Exception("low"); if (s.Length > max) throw new Exception("high"); return s; } string getStringLine(int min, int max) { string s = Console.ReadLine(); if (s.Length < min) throw new Exception("low"); if (s.Length > max) throw new Exception("high"); return s; } string[] splitLine(int min, int max) { string[] ret = Console.ReadLine().Split(' '); if (ret.Length < min || ret.Length > max) throw new Exception("wrong length"); return ret; } }
Submission Info
Submission Time | |
---|---|
Task | D - AtCoder社の冬 |
User | chokudai |
Language | C# (Mono 2.10.8.1) |
Score | 101 |
Code Size | 4063 Byte |
Status | AC |
Exec Time | 145 ms |
Memory | 15772 KB |
Judge Result
Set Name | sub | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 100 / 100 | 1 / 1 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
sub | 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, test_03E.txt, test_04E.txt, test_07E.txt, test_08E.txt, test_11E.txt, test_12E.txt, test_15E.txt, test_16E.txt, test_19E.txt, test_20E.txt, test_23E.txt, test_24E.txt, test_27E.txt, test_28E.txt, test_31E.txt, test_32E.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_45E.txt, test_47E.txt |
All | 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03E.txt, test_04E.txt, test_05.txt, test_06.txt, test_07E.txt, test_08E.txt, test_09.txt, test_10.txt, test_11E.txt, test_12E.txt, test_13.txt, test_14.txt, test_15E.txt, test_16E.txt, test_17.txt, test_18.txt, test_19E.txt, test_20E.txt, test_21.txt, test_22.txt, test_23E.txt, test_24E.txt, test_25.txt, test_26.txt, test_27E.txt, test_28E.txt, test_29.txt, test_30.txt, test_31E.txt, test_32E.txt, test_33.txt, test_34.txt, test_35.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45E.txt, test_46.txt, test_47E.txt, test_48.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01E.txt | AC | 136 ms | 15612 KB |
00_sample_02E.txt | AC | 134 ms | 15588 KB |
00_sample_03E.txt | AC | 135 ms | 15716 KB |
00_sample_04.txt | AC | 137 ms | 15652 KB |
test_01.txt | AC | 136 ms | 15644 KB |
test_02.txt | AC | 137 ms | 15644 KB |
test_03E.txt | AC | 145 ms | 15644 KB |
test_04E.txt | AC | 137 ms | 15580 KB |
test_05.txt | AC | 133 ms | 15592 KB |
test_06.txt | AC | 140 ms | 15720 KB |
test_07E.txt | AC | 136 ms | 15612 KB |
test_08E.txt | AC | 136 ms | 15644 KB |
test_09.txt | AC | 136 ms | 15644 KB |
test_10.txt | AC | 139 ms | 15716 KB |
test_11E.txt | AC | 135 ms | 15712 KB |
test_12E.txt | AC | 136 ms | 15624 KB |
test_13.txt | AC | 136 ms | 15684 KB |
test_14.txt | AC | 141 ms | 15652 KB |
test_15E.txt | AC | 137 ms | 15712 KB |
test_16E.txt | AC | 144 ms | 15644 KB |
test_17.txt | AC | 136 ms | 15608 KB |
test_18.txt | AC | 136 ms | 15644 KB |
test_19E.txt | AC | 135 ms | 15592 KB |
test_20E.txt | AC | 135 ms | 15644 KB |
test_21.txt | AC | 136 ms | 15652 KB |
test_22.txt | AC | 139 ms | 15652 KB |
test_23E.txt | AC | 138 ms | 15648 KB |
test_24E.txt | AC | 140 ms | 15648 KB |
test_25.txt | AC | 136 ms | 15716 KB |
test_26.txt | AC | 137 ms | 15584 KB |
test_27E.txt | AC | 135 ms | 15640 KB |
test_28E.txt | AC | 137 ms | 15620 KB |
test_29.txt | AC | 143 ms | 15652 KB |
test_30.txt | AC | 144 ms | 15652 KB |
test_31E.txt | AC | 136 ms | 15640 KB |
test_32E.txt | AC | 143 ms | 15644 KB |
test_33.txt | AC | 136 ms | 15628 KB |
test_34.txt | AC | 138 ms | 15592 KB |
test_35.txt | AC | 137 ms | 15644 KB |
test_36E.txt | AC | 139 ms | 15644 KB |
test_37E.txt | AC | 136 ms | 15592 KB |
test_38E.txt | AC | 136 ms | 15608 KB |
test_39E.txt | AC | 136 ms | 15644 KB |
test_40.txt | AC | 136 ms | 15652 KB |
test_41.txt | AC | 134 ms | 15648 KB |
test_42.txt | AC | 137 ms | 15652 KB |
test_43.txt | AC | 136 ms | 15652 KB |
test_44.txt | AC | 136 ms | 15652 KB |
test_45E.txt | AC | 136 ms | 15772 KB |
test_46.txt | AC | 140 ms | 15616 KB |
test_47E.txt | AC | 139 ms | 15588 KB |
test_48.txt | AC | 140 ms | 15644 KB |