QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#382718 | #3740. 2018 | 秦始皇派蒙恬还原神舟十二 (Jiancong Wen, Chu Jin, Zekai Zhang) | AC ✓ | 33ms | 35224kb | C++98 | 2.3kb | 2024-04-08 18:01:11 | 2024-04-08 18:01:12 |
Judging History
answer
/**
* ┏┓ ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃ ┃
* ┃ ━ ┃ ++ + + +
* ████━████ ┃+
* ┃ ┃ +
* ┃ ┻ ┃
* ┃ ┃ + +
* ┗━┓ ┏━┛
* ┃ ┃
* ┃ ┃ + + + +
* ┃ ┃ Code is far away from bug with the animal protecting
* ┃ ┃ + 神兽保佑,代码无bug
* ┃ ┃
* ┃ ┃ +
* ┃ ┗━━━┓ + +
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛ + + + +
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛+ + + +
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
//#define yes cout<<"YES\n"
//#define no cout<<"NO\n"
#define inf 0x3f3f3f3f
#define pii pair<int,int>
const int N = 2e3 + 20;
const int mod = 1e9 + 7;
int n, m;
ll f[N][N];
// int d[] = {1, 2, 1009, 2018};
// int a[N];
// map<int,int> p;
// vector<int> v;
void init ()
{
for (int i = 1; i <= 2e3; i ++) f[i][1] = i;
for (int i = 1; i <= 2e3; i ++) f[1][i] = i;
for (int i = 2; i <= 2e3; i ++)
{
for (int j = 2; j <= 2e3; j ++)
{
f[i][j] = f[i - 1][j] + f[i][j - 1] + 1;
f[i][j] %= mod;
}
}
}
void solve()
{
ll ans = f[n ][m ] * f[n ][m ] % mod;
cout << ans <<'\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T = 1;
init();
// cout << f[2000][2000];
// for (int i = 0; i < 4; i ++)
// ll x = dfs (d[i], 1999, 1999);
// p[1] = 1, p[2] = 2, p[1009] = 3, p[2018] = 0;
// cout <<"sdf";
while(cin >> n >>m)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 33ms
memory: 35224kb
input:
1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 1...
output:
1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500 4 25 81 196 400 729 1225 1936 2916 4225 5929 8100 10816 14161 18225 23104 28900 35721 43681 5...
result:
ok 100000 numbers