# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
399312 |
2021-05-05T14:50:12 Z |
jeqcho |
Boat (APIO16_boat) |
C++17 |
|
3 ms |
2272 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define fi first
#define se second
int const N=5e2+3;
int a[N],b[N];
ll dp[N][N];
ll mod =1e9+7;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
cin>>n;
set<int> st;
F0R(i,n)
{
cin>>a[i]>>b[i];
st.insert(a[i]);
}
vi v(all(st));
map<int,int>mp;
F0R(i,n)
{
mp[v[i]]=i+1;
}
F0R(i,n)
{
a[i]=mp[a[i]];
}
F0R(j,n+1)
{
dp[0][j]=0;
}
dp[0][0]=1;
F0R(i,n)
{
F0R(j,n+1)
{
dp[i+1][j]=dp[i][j];
}
ll sum=0;
F0R(j,a[i])
{
sum += dp[i][j];
sum%=mod;
}
dp[i+1][a[i]] += sum;
dp[i+1][a[i]]%=mod;
}
ll ans=0;
FOR(j,1,n+1)
{
ans+=dp[n][j];
ans%=mod;
}
cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2252 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2252 KB |
Output is correct |
5 |
Correct |
3 ms |
2252 KB |
Output is correct |
6 |
Correct |
3 ms |
2256 KB |
Output is correct |
7 |
Correct |
3 ms |
2248 KB |
Output is correct |
8 |
Correct |
3 ms |
2248 KB |
Output is correct |
9 |
Correct |
3 ms |
2252 KB |
Output is correct |
10 |
Correct |
3 ms |
2272 KB |
Output is correct |
11 |
Correct |
3 ms |
2252 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2252 KB |
Output is correct |
14 |
Correct |
3 ms |
2252 KB |
Output is correct |
15 |
Correct |
3 ms |
2252 KB |
Output is correct |
16 |
Incorrect |
2 ms |
2248 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2252 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2252 KB |
Output is correct |
5 |
Correct |
3 ms |
2252 KB |
Output is correct |
6 |
Correct |
3 ms |
2256 KB |
Output is correct |
7 |
Correct |
3 ms |
2248 KB |
Output is correct |
8 |
Correct |
3 ms |
2248 KB |
Output is correct |
9 |
Correct |
3 ms |
2252 KB |
Output is correct |
10 |
Correct |
3 ms |
2272 KB |
Output is correct |
11 |
Correct |
3 ms |
2252 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2252 KB |
Output is correct |
14 |
Correct |
3 ms |
2252 KB |
Output is correct |
15 |
Correct |
3 ms |
2252 KB |
Output is correct |
16 |
Incorrect |
2 ms |
2248 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2252 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2252 KB |
Output is correct |
5 |
Correct |
3 ms |
2252 KB |
Output is correct |
6 |
Correct |
3 ms |
2256 KB |
Output is correct |
7 |
Correct |
3 ms |
2248 KB |
Output is correct |
8 |
Correct |
3 ms |
2248 KB |
Output is correct |
9 |
Correct |
3 ms |
2252 KB |
Output is correct |
10 |
Correct |
3 ms |
2272 KB |
Output is correct |
11 |
Correct |
3 ms |
2252 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
3 ms |
2252 KB |
Output is correct |
14 |
Correct |
3 ms |
2252 KB |
Output is correct |
15 |
Correct |
3 ms |
2252 KB |
Output is correct |
16 |
Incorrect |
2 ms |
2248 KB |
Output isn't correct |
17 |
Halted |
0 ms |
0 KB |
- |