#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
#include <string>
#include <ios>
#include <iomanip>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#define FASTIO ios_base::sync_with_stdio(0); cin.tie(NULL);
#define CY cout<<"YES"<<endl
#define CN cout<<"NO"<<endl
#define ll long long
#define ciN cin
#define itn int
#define pshb push_back
#define sz size()
#define vec vector<int>
#define vecl vector<long long>
#define fro for
#define Int int
#define stirng string
#define nedl endl
#define pi 3.141592653589793238463
#define endl '\n'
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;
void solve() {
itn n; cin >> n;
int m; cin >> m;
vec v(n);
for (itn i = 0; i < n; i++)cin >> v[i];
if (n <= 500 && m <= 500) {
for (int i = 0; i < m; i++) {
int l, r, k; cin >> l >> r >> k;
l--; r--;
ll mx = v[l];
ll sum = 0;
for (int j = l+1; j <= r; j++) {
if (mx > v[j])sum = max(sum, mx + v[i]);
else mx = v[i];
}
if (sum < k)cout << 0 << endl;
else cout << 1 << endl;
}
}
}
signed main() {
FASTIO
//int t; cin >> t;
//while (t--)
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
14340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1368 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |