# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
32225 | giatuevu | Boat (APIO16_boat) | C++14 | 3 ms | 2032 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair <long long,long long> ll;
ll a[505];
long long n,f[505][2],mod=1e9+7,kq;
bool check1,check2,check3;
void sub1()
{
for (int i=1; i<=n; ++i)
{
long long pos=1,pos2=1;
for (int j=1; j<i; ++j)
{
f[i][0]=(f[i][0]+f[j][1])%mod;
if (a[i].first>a[j].first) f[i][1]=(f[i][1]+f[j][1])%mod;
}
f[i][1]++;
}
cout<<(f[n][0]+f[n][1])%mod;
}
int main()
{
cin>>n;
check1=check2=check3=true;
for (int i=1; i<=n; ++i)
{
cin>>a[i].first>>a[i].second;
if (a[i].first!=a[i].second) check1=false;
}
if (check1==true) sub1();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |