Submission #668374

#TimeUsernameProblemLanguageResultExecution timeMemory
668374danikoynovBoat (APIO16_boat)C++14
9 / 100
2 ms316 KiB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int maxn = 510;
const ll mod = 1e9 + 7;

int n, a[maxn], b[maxn];
ll dp[maxn];

void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i ++)
        cin >> a[i] >> b[i];

        ll ans = 0;
    for (int i = 1; i <= n; i ++)
    {
        dp[i] = 1;
        for (int j = 1; j < i; j ++)
        {
            if (a[i] > a[j])
                dp[i] = (dp[i] + dp[j]) % mod;
        }

        ans = (ans + dp[i]) % mod;
    }
    cout << ans << endl;

}

int main()
{
    solve();
    return 0;
}

Compilation message (stderr)

boat.cpp: In function 'void solve()':
boat.cpp:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |     for (int i = 1; i <= n; i ++)
      |     ^~~
boat.cpp:34:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   34 |         ll ans = 0;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...