Submission #692303

# Submission time Handle Problem Language Result Execution time Memory
692303 2023-02-01T10:29:15 Z saayan007 Mountains (IOI17_mountains) C++17
0 / 100
1 ms 212 KB
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
using vi = vector<int>;
using vl = vector<long long>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<long long, long long>>;

#define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i)
#define fr first 
#define sc second
#define mp make_pair
#define pb emplace_back
#define nl "\n"
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()


int maximum_deevs(vector<int> y) {
    int ans = 1;
    int n = y.size();

    bool ok[n][n] = {};
    for(int i = 0; i < n; ++i) {
        for(int j = i + 2; j < n; ++j) {
            for(int k = i + 1; k < j; ++k) {
                if(i * (y[k] - y[j]) - k * (y[i] - y[j]) + j * (y[i] - y[k]) < 0)
                    ok[i][j] = 1;
            }
        }
    }

    int dp[n] = {};
    dp[n] = 1;
    for(int i = n - 1; i >= 0; --i) {
        dp[i] = 1;
        for(int j = i + 2; j < n; ++j) {
            if(ok[i][j]) {
                dp[i] = max(dp[i], dp[j] + 1);
            }
        }
        ans = max(ans, dp[i]);
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -