Submission #38778

# Submission time Handle Problem Language Result Execution time Memory
38778 2018-01-06T13:55:26 Z oTTo_22 Boat (APIO16_boat) C++14
0 / 100
0 ms 2176 KB
#include <bits/stdc++.h>
#define se second
#define fi first
const int MOD=1000000007;
using namespace std;

int dp[501];

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
  
    int n;
    cin >> n;

    int p[n+1];

    p[0]=0;

    for (int i=1; i<=n; i++) {
        int l,r;
        cin >> l >> r;
        p[i]=r;
    }

    for (int i=1; i<=n; i++) {
        for (int k=1; k<i; k++)
            if (p[i]>p[k])
                dp[i]+=dp[k];
        dp[i]++;
    }

    int ans=0;
    for (int i=1; i<=n; i++)
        ans+=dp[i];
    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2176 KB Output isn't correct
2 Halted 0 ms 0 KB -