Submission #3054778
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define int long long const int N = 2001; const int mod = 1e9 + 7; void add(int &a,int b) { a += b; if(a >= mod)a -= mod; if(a < 0) a += mod; } int mul[N * 2][N * 2]; int upd[N * 2][N * 2]; int com[N * 2][N * 2]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); com[0][0] = 1; for(int i = 1 ; i < N + N ; ++i) { com[i][0] = 1; for(int j = 1 ; j < N + N ; ++j) add(com[i][j],com[i - 1][j]), add(com[i][j],com[i - 1][j - 1]); } int n; cin >> n; int ans = 0; while(n--) { int x, y; cin >> x >> y; upd[N - x][N - y]++; mul[N + x][N + y]++; add(ans,-com[2 * x + 2 * y][2 * x]); } for(int i = 1 ; i < 2 * N ; ++i) for(int j = 1 ; j < 2 * N ; ++j) { add(upd[i][j],upd[i][j - 1]); add(upd[i][j],upd[i - 1][j]); add(ans,mul[i][j] * upd[i][j] % mod); } cout << ans * 500000004ll % mod << endl; }
Submission Info
Submission Time | |
---|---|
Task | E - BBQ Hard |
User | combi2k2 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1117 Byte |
Status | WA |
Exec Time | 293 ms |
Memory | 316032 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 | 209 ms | 256256 KB |
01-02.txt | MLE | 242 ms | 315648 KB |
01-03.txt | MLE | 267 ms | 316032 KB |
01-04.txt | MLE | 291 ms | 316032 KB |
01-05.txt | MLE | 291 ms | 316032 KB |
01-06.txt | WA | 256 ms | 252160 KB |
01-07.txt | AC | 188 ms | 254208 KB |
01-08.txt | AC | 209 ms | 254208 KB |
01-09.txt | WA | 236 ms | 254208 KB |
01-10.txt | MLE | 276 ms | 283136 KB |
01-11.txt | MLE | 278 ms | 283136 KB |
01-12.txt | MLE | 261 ms | 262528 KB |
01-13.txt | MLE | 293 ms | 316032 KB |
01-14.txt | MLE | 292 ms | 316032 KB |
sample-01.txt | AC | 188 ms | 254208 KB |