Submission #2099302
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], t[2*N];
inline void add(int &x, int y) {
x+=y;
if(x>=P) x-=P;
}
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];
add(bn[i][j], bn[i-1][j-1]);
}
scanf("%d", &n);
for(i=0; i<n; i++) {
scanf("%d%d", &a, &b);
add(ans, P-bn[2*a+2*b][2*b]);
for(j=0; j<=a+b; j++)
add(t[N-a+j], bn[a+b][j]);
}
for(i=-N+1; i<N; i++)
add(ans, t[i+N]*(ll)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 |
0 |
Code Size |
1215 Byte |
Status |
TLE |
Exec Time |
2104 ms |
Memory |
249856 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:38:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:40: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 |
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 |
AC |
175 ms |
249728 KB |
01-02.txt |
AC |
186 ms |
249728 KB |
01-03.txt |
AC |
1241 ms |
249728 KB |
01-04.txt |
TLE |
2104 ms |
249728 KB |
01-05.txt |
TLE |
2104 ms |
249728 KB |
01-06.txt |
TLE |
2104 ms |
249728 KB |
01-07.txt |
AC |
175 ms |
249728 KB |
01-08.txt |
AC |
201 ms |
249728 KB |
01-09.txt |
TLE |
2104 ms |
249728 KB |
01-10.txt |
TLE |
2104 ms |
249728 KB |
01-11.txt |
TLE |
2104 ms |
249728 KB |
01-12.txt |
TLE |
2104 ms |
249728 KB |
01-13.txt |
TLE |
2104 ms |
249728 KB |
01-14.txt |
TLE |
2104 ms |
249856 KB |
sample-01.txt |
AC |
175 ms |
249728 KB |