Submission #8815658
Source Code Expand
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 2010, LOG=20;
ll n, m, k, u, v, x, y, t, a, b, ans;
ll X[200001], Y[200001];
ll dp[MAXN*2][MAXN*2];
int C[MAXN*4][MAXN*4];
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin>>n;
for (int i=1; i<=n; i++) cin>>X[i]>>Y[i], dp[MAXN-X[i]][MAXN-Y[i]]++;
for (int i=1; i<MAXN*2; i++) for (int j=1; j<MAXN*2; j++) dp[i][j]=(dp[i][j] + dp[i-1][j] + dp[i][j-1])%mod;
for (int i=0; i<MAXN*4; i++){
C[i][0]=C[i][i]=1;
for (int j=1; j<i; j++) C[i][j]=(C[i-1][j] + C[i-1][j-1])%mod;
}
for (int i=1; i<=n; i++){
ans=(ans + dp[MAXN+X[i]][MAXN+Y[i]])%mod;
ans=(ans - C[X[i]*2+Y[i]*2][X[i]*2])%mod;
}
ans=ans*(mod+1)/2%mod;
if (ans<0) ans+=mod;
cout<<ans<<'\n';
return 0;
}
Submission Info
Submission Time |
|
Task |
E - BBQ Hard |
User |
alishahali1382 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1620 Byte |
Status |
MLE |
Exec Time |
267 ms |
Memory |
380416 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 1400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample-01.txt |
All |
sample-01.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, sample-01.txt |
Case Name |
Status |
Exec Time |
Memory |
01-01.txt |
MLE |
227 ms |
379264 KB |
01-02.txt |
MLE |
219 ms |
379392 KB |
01-03.txt |
MLE |
243 ms |
379648 KB |
01-04.txt |
MLE |
265 ms |
380416 KB |
01-05.txt |
MLE |
267 ms |
380416 KB |
01-06.txt |
MLE |
246 ms |
380416 KB |
01-07.txt |
MLE |
218 ms |
379392 KB |
01-08.txt |
MLE |
240 ms |
380416 KB |
01-09.txt |
MLE |
246 ms |
380416 KB |
01-10.txt |
MLE |
255 ms |
380288 KB |
01-11.txt |
MLE |
256 ms |
380416 KB |
01-12.txt |
MLE |
249 ms |
380416 KB |
01-13.txt |
MLE |
265 ms |
380416 KB |
01-14.txt |
MLE |
265 ms |
380416 KB |
sample-01.txt |
MLE |
218 ms |
379392 KB |