Submission #19688105
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int M = 200010;
long long d[M];
void initd()
{
d[0] = d[1] = 1;
for (long long i = 2; i < M; i++){
d[i] = d[i-1] * i % MOD;
}
}
long long modpow(long long x, long long n, long long p)
{
if (n == 0) return 1;
if (n & 1) return (x * modpow(x, n-1, p) % p);
return modpow(x * x % p, n >> 1, p);
}
long long modinv(long long x, long long p)
{
return (modpow(x, p-2, p));
}
long long fact(int x)
{
if (d[0] == 0){ initd(); }
return d[x];
}
long long c(int n, int r)
{
return (fact(n) * modinv(fact(n-r), MOD) % MOD * modinv(fact(r), MOD) % MOD);
}
int main()
{
int w, h;
cin >> w >> h; w--; h--;
cout << c(w+h, w) << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 経路 |
| User | unnohideyuki |
| Language | C++ (GCC 9.2.1) |
| Score | 101 |
| Code Size | 798 Byte |
| Status | AC |
| Exec Time | 12 ms |
| Memory | 5192 KiB |
Judge Result
| Set Name | Sample | Dataset1 | Dataset2 | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 50 / 50 | 50 / 50 | 1 / 1 | ||||||||
| Status |
|
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s0.txt, s1.txt |
| Dataset1 | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, s0.txt |
| Dataset2 | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, s0.txt, s1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, s0.txt, s1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 10 ms | 4972 KiB |
| 001.txt | AC | 5 ms | 4972 KiB |
| 002.txt | AC | 6 ms | 5128 KiB |
| 003.txt | AC | 9 ms | 5116 KiB |
| 004.txt | AC | 5 ms | 4972 KiB |
| 005.txt | AC | 5 ms | 5120 KiB |
| 006.txt | AC | 5 ms | 5080 KiB |
| 007.txt | AC | 6 ms | 5172 KiB |
| 008.txt | AC | 4 ms | 5116 KiB |
| 009.txt | AC | 5 ms | 5120 KiB |
| 010.txt | AC | 9 ms | 5100 KiB |
| 011.txt | AC | 7 ms | 4964 KiB |
| 012.txt | AC | 7 ms | 5124 KiB |
| 013.txt | AC | 6 ms | 4904 KiB |
| 014.txt | AC | 7 ms | 5100 KiB |
| 015.txt | AC | 6 ms | 4964 KiB |
| 016.txt | AC | 5 ms | 4972 KiB |
| 017.txt | AC | 8 ms | 4908 KiB |
| 018.txt | AC | 6 ms | 4960 KiB |
| 019.txt | AC | 5 ms | 5168 KiB |
| 020.txt | AC | 4 ms | 5080 KiB |
| 021.txt | AC | 5 ms | 5096 KiB |
| 022.txt | AC | 6 ms | 5116 KiB |
| 023.txt | AC | 5 ms | 5128 KiB |
| 024.txt | AC | 6 ms | 5128 KiB |
| 025.txt | AC | 11 ms | 5060 KiB |
| 026.txt | AC | 9 ms | 5116 KiB |
| 027.txt | AC | 5 ms | 5128 KiB |
| 028.txt | AC | 5 ms | 5172 KiB |
| 029.txt | AC | 5 ms | 5124 KiB |
| 030.txt | AC | 8 ms | 4972 KiB |
| 031.txt | AC | 5 ms | 5192 KiB |
| 032.txt | AC | 6 ms | 5120 KiB |
| s0.txt | AC | 9 ms | 5120 KiB |
| s1.txt | AC | 12 ms | 4960 KiB |