Submission #2099334
Source Code Expand
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
tree_order_statistics_node_update> ost;
const int N=4010;
const ll P=1e9+7;
const ll PH=(P+1)/2;
int bn[2*N][2*N];
ll t[2*N];
int main() {
int i, j, n, a, b, ans=0;
for(i=0; i<2*N; i++) bn[i][0]=1;
for(i=1; i<2*N; i++) for(j=1; j<=i; j++) {
bn[i][j]=bn[i-1][j]+bn[i-1][j-1];
if(bn[i][j]>=P) bn[i][j]-=P;
}
scanf("%d", &n);
for(i=0; i<n; i++) {
scanf("%d%d", &a, &b);
ans=(ans+P-bn[2*a+2*b][2*b])%P;
for(j=0; j<=a+b; j++)
t[N-a+j]+=bn[a+b][j];
}
for(i=-N+1; i<N; i++) t[N+i]%=P;
for(i=-N+1; i<N; i++)
ans=(ans+t[i+N]*t[-i+N])%P;
printf("%lld\n",ans*PH%P);
return 0;
}
Submission Info
Submission Time |
|
Task |
E - BBQ Hard |
User |
Ajira |
Language |
C++14 (GCC 5.4.1) |
Score |
1400 |
Code Size |
1193 Byte |
Status |
AC |
Exec Time |
978 ms |
Memory |
249856 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:34:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:36:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &a, &b);
^
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, sample-01.txt |
Case Name |
Status |
Exec Time |
Memory |
01-01.txt |
AC |
169 ms |
249856 KB |
01-02.txt |
AC |
171 ms |
249856 KB |
01-03.txt |
AC |
391 ms |
249856 KB |
01-04.txt |
AC |
615 ms |
249856 KB |
01-05.txt |
AC |
614 ms |
249856 KB |
01-06.txt |
AC |
978 ms |
249856 KB |
01-07.txt |
AC |
169 ms |
249856 KB |
01-08.txt |
AC |
194 ms |
249856 KB |
01-09.txt |
AC |
651 ms |
249856 KB |
01-10.txt |
AC |
787 ms |
249856 KB |
01-11.txt |
AC |
813 ms |
249856 KB |
01-12.txt |
AC |
925 ms |
249856 KB |
01-13.txt |
AC |
612 ms |
249856 KB |
01-14.txt |
AC |
613 ms |
249856 KB |
sample-01.txt |
AC |
169 ms |
249856 KB |