0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:56:27 +00:00

E - BBQ Hard

https://atcoder.jp/contests/agc001/submissions/37074356
This commit is contained in:
Baoshuo Ren 2022-12-07 16:16:54 +08:00
parent f6c6af3bd7
commit a97d1c11ac
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
31 changed files with 160 additions and 0 deletions

70
AtCoder/AGC001/E/E.cpp Normal file
View File

@ -0,0 +1,70 @@
#include <iostream>
#include <algorithm>
#include <cstring>
#include <iterator>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2e5 + 5,
M = 2005;
const int mod = 1e9 + 7;
int n, m, a[N], b[N], inv[M << 2], fac[M << 2], inv_fac[M << 2], _f[M << 1][M << 1], *_pf[M << 1], **f, ans;
inline int C(int n, int m) {
return static_cast<long long>(fac[n]) * inv_fac[m] % mod * inv_fac[n - m] % mod;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
fac[0] = 1;
for (int i = 1; i < M << 2; i++) {
fac[i] = static_cast<long long>(fac[i - 1]) * i % mod;
}
inv[0] = inv[1] = 1;
for (int i = 2; i < M << 2; i++) {
inv[i] = static_cast<long long>(mod - (mod / i)) * inv[mod % i] % mod;
}
inv_fac[0] = inv_fac[1] = 1;
for (int i = 2; i < M << 2; i++) {
inv_fac[i] = static_cast<long long>(inv_fac[i - 1]) * inv[i] % mod;
}
for (int i = 0; i < M << 1; i++) {
_pf[i] = _f[i] + M;
}
f = _pf + M;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> b[i];
f[-a[i]][-b[i]]++;
}
for (int i = -2000; i <= 2000; i++) {
for (int j = -2000; j <= 2000; j++) {
f[i][j] = (static_cast<long long>(f[i][j]) + f[i - 1][j] + f[i][j - 1]) % mod;
}
}
for (int i = 1; i <= n; i++) {
ans = (static_cast<long long>(ans) + f[a[i]][b[i]]) % mod;
}
for (int i = 1; i <= n; i++) {
ans = ((static_cast<long long>(ans) - C(2 * a[i] + 2 * b[i], 2 * a[i])) % mod + mod) % mod;
}
cout << (static_cast<long long>(ans) * inv[2] % mod) << endl;
return 0;
}

BIN
AtCoder/AGC001/E/data/01-01.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-01.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-02.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-02.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-03.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-03.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-04.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-04.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-05.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-05.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-06.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-06.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-07.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-07.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-08.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-08.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-09.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-09.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/01-14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/sample-01.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC001/E/data/sample-01.out (Stored with Git LFS) Normal file

Binary file not shown.