Submission #44208

# Submission time Handle Problem Language Result Execution time Memory
44208 2018-03-30T14:06:56 Z faustaadp Boat (APIO16_boat) C++17
9 / 100
2000 ms 524288 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,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];
	}
	vector<ll> v[550],p[550];
	for(i=n;i>=1;i--)
	{
		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[k][max(0LL,j-a[k]+1)];
				tem%=mo;
			}
			v[i].pb(tem);
			p[i].pb(0);
			has+=tem;
			has%=mo;
		}
		p[i].pb(0);
		for(j=b[i]-a[i];j>=0;j--)
			p[i][j]=(p[i][j+1]+v[i][j])%mo;
	}
	cout<<has<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 4 ms 496 KB Output is correct
3 Correct 4 ms 684 KB Output is correct
4 Correct 4 ms 684 KB Output is correct
5 Correct 4 ms 684 KB Output is correct
6 Correct 5 ms 796 KB Output is correct
7 Correct 5 ms 796 KB Output is correct
8 Correct 5 ms 804 KB Output is correct
9 Correct 5 ms 816 KB Output is correct
10 Correct 5 ms 828 KB Output is correct
11 Correct 5 ms 900 KB Output is correct
12 Correct 6 ms 912 KB Output is correct
13 Correct 5 ms 924 KB Output is correct
14 Correct 5 ms 936 KB Output is correct
15 Correct 5 ms 948 KB Output is correct
16 Correct 4 ms 1152 KB Output is correct
17 Correct 4 ms 1152 KB Output is correct
18 Correct 4 ms 1152 KB Output is correct
19 Correct 5 ms 1152 KB Output is correct
20 Correct 4 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 4 ms 496 KB Output is correct
3 Correct 4 ms 684 KB Output is correct
4 Correct 4 ms 684 KB Output is correct
5 Correct 4 ms 684 KB Output is correct
6 Correct 5 ms 796 KB Output is correct
7 Correct 5 ms 796 KB Output is correct
8 Correct 5 ms 804 KB Output is correct
9 Correct 5 ms 816 KB Output is correct
10 Correct 5 ms 828 KB Output is correct
11 Correct 5 ms 900 KB Output is correct
12 Correct 6 ms 912 KB Output is correct
13 Correct 5 ms 924 KB Output is correct
14 Correct 5 ms 936 KB Output is correct
15 Correct 5 ms 948 KB Output is correct
16 Correct 4 ms 1152 KB Output is correct
17 Correct 4 ms 1152 KB Output is correct
18 Correct 4 ms 1152 KB Output is correct
19 Correct 5 ms 1152 KB Output is correct
20 Correct 4 ms 1152 KB Output is correct
21 Execution timed out 2061 ms 13436 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1091 ms 524288 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 Correct 4 ms 376 KB Output is correct
2 Correct 4 ms 496 KB Output is correct
3 Correct 4 ms 684 KB Output is correct
4 Correct 4 ms 684 KB Output is correct
5 Correct 4 ms 684 KB Output is correct
6 Correct 5 ms 796 KB Output is correct
7 Correct 5 ms 796 KB Output is correct
8 Correct 5 ms 804 KB Output is correct
9 Correct 5 ms 816 KB Output is correct
10 Correct 5 ms 828 KB Output is correct
11 Correct 5 ms 900 KB Output is correct
12 Correct 6 ms 912 KB Output is correct
13 Correct 5 ms 924 KB Output is correct
14 Correct 5 ms 936 KB Output is correct
15 Correct 5 ms 948 KB Output is correct
16 Correct 4 ms 1152 KB Output is correct
17 Correct 4 ms 1152 KB Output is correct
18 Correct 4 ms 1152 KB Output is correct
19 Correct 5 ms 1152 KB Output is correct
20 Correct 4 ms 1152 KB Output is correct
21 Execution timed out 2061 ms 13436 KB Time limit exceeded
22 Halted 0 ms 0 KB -