Submission #810127
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int MOD = 1e9+7;
int p[2*N][2*N];
int C[4*N][2*N];
int main() {
for (int i=0;i<4*N;i++)
for (int j=0;j<=min(i,2*N-1);j++)
if (i == j) C[i][j] = 1;
else if (j == 0) C[i][j] = 1;
else C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
int n;
int ans = 0;
int ans2 = 0;
scanf("%d",&n);
for (int i=0;i<n;i++) {
int x,y;
scanf("%d %d",&x,&y);
p[N-x][N-y]++;
p[N+x][N+y]++;
ans = (ans + C[2*(x+y)][2*x]) % MOD;
}
for (int i=1;i<2*N;i++)
for (int j=1;j<2*N;j++) {
if (i>N && j>N && p[i][j]) {
ans2 = ((1ll*p[i][j]*((p[i-1][j] + p[i][j-1]) % MOD)) % MOD + ans2) % MOD;
p[i][j] = (p[i-1][j] + p[i][j-1]) % MOD;
}
else p[i][j] = (1ll*p[i-1][j] + p[i][j-1] + p[i][j]) % MOD;
}
ans = (ans2+MOD-ans) % MOD;
if (ans % 2) ans += MOD;
printf("%d\n",ans/2);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - BBQ Hard |
| User | tcchung |
| Language | C++14 (GCC 5.4.1) |
| Score | 1400 |
| Code Size | 906 Byte |
| Status | AC |
| Exec Time | 722 ms |
| Memory | 172032 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:16:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:19:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&x,&y);
^
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 1400 / 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01-01.txt | AC | 656 ms | 172032 KiB |
| 01-02.txt | AC | 647 ms | 172032 KiB |
| 01-03.txt | AC | 647 ms | 172032 KiB |
| 01-04.txt | AC | 697 ms | 172032 KiB |
| 01-05.txt | AC | 695 ms | 172032 KiB |
| 01-06.txt | AC | 708 ms | 172032 KiB |
| 01-07.txt | AC | 656 ms | 172032 KiB |
| 01-08.txt | AC | 694 ms | 172032 KiB |
| 01-09.txt | AC | 708 ms | 172032 KiB |
| 01-10.txt | AC | 718 ms | 172032 KiB |
| 01-11.txt | AC | 720 ms | 172032 KiB |
| 01-12.txt | AC | 722 ms | 172032 KiB |
| 01-13.txt | AC | 716 ms | 172032 KiB |
| 01-14.txt | AC | 695 ms | 172032 KiB |
| sample-01.txt | AC | 655 ms | 172032 KiB |