#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
typedef long long ll;
constexpr int mod = 1000000000+7;
int main()
{
int n = 0; cin>>n;
vector<pair<ll,ll> >sizes(n);
for(int i =0; i<n; ++i)
{
cin>>sizes[i].first;
}
for(int i =0; i<n; ++i)
{
cin>>sizes[i].second;
}
vector<bitset<51>> grid(n);
vector<vector<vector<bitset<51>>>> dp(51,vector<vector<bitset<51>>>(51, vector<bitset<51>>(51)));
for(int i = 0; i<n; ++i)
{
for(int h = 0; h<sizes[i].second; ++h)
{
grid[i].set(h);
}
}
ll num = 0;
// cout<<"reach"<<endl;
for(int startX = 0; startX<51; ++startX)
{
// cout<<"start X : "<<startX<<endl;
for(int startY = 0; startY < 51; ++startY)
{
// cout<<"startY " << startY<<endl;
if(grid[startX].test(startY))
{
num++;
num%= mod;
dp[startX][startY][startX].set(startY);
}
// cout<<"trivial case "<<endl;
for(int x = startX; x < 51; ++x)
{
for(int y = startY; y <51; ++y)
{
// cout<<"x,y "<<x<<" "<<y<<endl;
if(grid[x].test(y))
{
if(dp[startX][startY][max(startX, x-1)].test(y)
&& dp[startX][startY][x].test(max(startY, y-1)))
{
if(startX != x && startY != y)
{
num++;
num%= mod;
dp[startX][startY][x].set(y);
}
}
}
}
}
}
}
//cout<<"reach2"<<endl;
cout<<num<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
2900 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |