Submission #44207

# Submission time Handle Problem Language Result Execution time Memory
44207 2018-03-30T14:02:29 Z faustaadp Boat (APIO16_boat) C++17
0 / 100
1319 ms 521392 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,i,a[550],b[550],j,k,has,p[1010101],mo=1000000007;
int main()
{
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(i=n;i>=1;i--)
	{
		vector<ll> v;
		for(j=a[i];j<=b[i];j++)
		{
			ll tem=1;
			for(k=i+1;k<=n;k++)
			{
				if(j>=b[k])
					continue;
				tem+=p[max(0LL,j-a[k]+1)];
				tem%=mo;
			}
			v.pb(tem);
			has+=tem;
			has%=mo;
		}
		p[b[i]-a[i]+1]=0;
		for(j=b[i]-a[i];j>=0;j--)
			p[j]=(p[j+1]+v[j])%mo;
	}
	cout<<has<<"\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1319 ms 521392 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -