Submission #879054

# Submission time Handle Problem Language Result Execution time Memory
879054 2023-11-26T08:10:52 Z Elvin_Fritl Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 14340 KB
#include <bits/stdc++.h>
using namespace std;
 
#define io                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

 
typedef long long ll;
 
ll bp(ll n,ll m){
    if(m == 0){
        return 1;
    }
    if(m == 1){
        return n;
    }
    if(m%2==0){
        return bp(n*n,m/2);
    }
    return n*bp(n,m-1);
}

 
const int N =  1020, M = 33, inf = 1e9 + 99;
const ll inff = 1e12;
 
 
 void solve() {
	int n, q;
    cin >> n >> q;
    vector<int> v(n);
    for(int i=0;i<n;i++) {
		cin >> v[i];
	}
    while(q--) {
        int l, r, k;
        cin >> l >> r >> k;
        int mx = v[l - 1], res = 0,ans = 1;
        for(int i=l;i<r;i++) {
            if(mx > v[i]) {
                res = max(res, mx + v[i]);
            }
            mx = max(mx, v[i]);
            if(res > k) {
				ans = 0;
			}
        }
        
        cout << ans << '\n';
    }
}
 
int main()
{
	io;
	
	int t = 1;
	///  cin >> t;
	while(t--) {
		solve();
	}
    
    return 0;
 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 3 ms 352 KB Output is correct
12 Correct 6 ms 348 KB Output is correct
13 Correct 7 ms 468 KB Output is correct
14 Correct 12 ms 760 KB Output is correct
15 Correct 12 ms 600 KB Output is correct
16 Correct 19 ms 464 KB Output is correct
17 Correct 14 ms 344 KB Output is correct
18 Correct 19 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3067 ms 14340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2919 ms 3096 KB Output is correct
2 Execution timed out 3048 ms 1860 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 3 ms 352 KB Output is correct
12 Correct 6 ms 348 KB Output is correct
13 Correct 7 ms 468 KB Output is correct
14 Correct 12 ms 760 KB Output is correct
15 Correct 12 ms 600 KB Output is correct
16 Correct 19 ms 464 KB Output is correct
17 Correct 14 ms 344 KB Output is correct
18 Correct 19 ms 348 KB Output is correct
19 Execution timed out 3018 ms 4856 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 352 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 3 ms 352 KB Output is correct
12 Correct 6 ms 348 KB Output is correct
13 Correct 7 ms 468 KB Output is correct
14 Correct 12 ms 760 KB Output is correct
15 Correct 12 ms 600 KB Output is correct
16 Correct 19 ms 464 KB Output is correct
17 Correct 14 ms 344 KB Output is correct
18 Correct 19 ms 348 KB Output is correct
19 Execution timed out 3067 ms 14340 KB Time limit exceeded
20 Halted 0 ms 0 KB -