Submission #992762

# Submission time Handle Problem Language Result Execution time Memory
992762 2024-06-05T06:59:43 Z danikoynov Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 262144 KB
#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 = 1e6 + 10;

int n, m, w[maxn];
void solve()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i ++)
    {
        cin >> w[i];
    }

    stack < int > st;
    vector < pair < int, int > > fun;

    for (int i = 1; i <= n; i ++)
        for (int j = i + 1; j <= n; j ++)
        if (w[i] > w[j])
    fun.push_back({i, j});
    /**for (int i = 1; i <= n; i ++)
    {
        while(!st.empty() && w[st.top()] <= w[i])
            st.pop();

        if (!st.empty())
        {
            fun.push_back({st.top(), i});
        }
        st.push(i);

    }*/

    for (int i = 1; i <= m; i ++)
    {
        int l, r, k;
        cin >> l >> r >> k;
        int mx = 0;

        for (pair < int, int > cur : fun)
        {
            if (cur.first >= l && cur.second <= r)
                mx = max(mx, w[cur.first] + w[cur.second]);
        }

        cout << (mx <= k) << endl;
    }
}

int main()
{
    speed();
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 36 ms 992 KB Output is correct
7 Correct 25 ms 992 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 4 ms 428 KB Output is correct
10 Correct 8 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 36 ms 992 KB Output is correct
7 Correct 25 ms 992 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 4 ms 428 KB Output is correct
10 Correct 8 ms 860 KB Output is correct
11 Correct 1176 ms 5844 KB Output is correct
12 Execution timed out 3053 ms 66216 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 316 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 256 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 36 ms 992 KB Output is correct
7 Correct 25 ms 992 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 4 ms 428 KB Output is correct
10 Correct 8 ms 860 KB Output is correct
11 Correct 1176 ms 5844 KB Output is correct
12 Execution timed out 3053 ms 66216 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 36 ms 992 KB Output is correct
7 Correct 25 ms 992 KB Output is correct
8 Correct 4 ms 348 KB Output is correct
9 Correct 4 ms 428 KB Output is correct
10 Correct 8 ms 860 KB Output is correct
11 Correct 1176 ms 5844 KB Output is correct
12 Execution timed out 3053 ms 66216 KB Time limit exceeded
13 Halted 0 ms 0 KB -