Submission #878813

# Submission time Handle Problem Language Result Execution time Memory
878813 2023-11-25T09:21:27 Z OAleksa Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 18788 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
 
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
   int tt = 1;
  	//cin >> tt;
   while (tt--) {
   	int n, q;
   	cin >> n >> q;
   	vector<int> a(n);
   	for (int i = 0;i < n;i++)
   		cin >> a[i];
   	while(q--) {
   		int l, r, k;
   		cin >> l >> r >> k;
   		--l, --r;
   		bool ok = 1;
   		int mx = a[l];
   		for (int i = l + 1;i <= r;i++) {
   			if (mx > a[i])
   				ok &= (mx + a[i] <= k);
   			else
   				mx = a[i];
   		}
   		cout << (ok ? 1 : 0) << '\n';
   	}
	}
	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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 348 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 8 ms 648 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 12 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3086 ms 18788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1635 ms 3576 KB Output is correct
2 Execution timed out 3033 ms 2688 KB Time limit exceeded
3 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 8 ms 648 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 12 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 540 KB Output is correct
19 Execution timed out 3033 ms 6460 KB Time limit exceeded
20 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 596 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 8 ms 648 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 12 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 540 KB Output is correct
19 Execution timed out 3086 ms 18788 KB Time limit exceeded
20 Halted 0 ms 0 KB -