// Problem: A - Hedgehog Daniyar and Algorithms
// Contest: Virtual Judge - IOI contest #3 (div 1 + 2)
// URL: https://vjudge.net/contest/610287#problem/A
// Memory Limit: 256 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz size()
#define yes "YES"
#define no "NO"
#define ok "OK\n"
#define IOI ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pf push_front
#define pb push_back
#define S second
#define F first
using namespace std;
const int N = 1e6 + 5;
const int NN = 3e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e11;
int n, m;
int a[N], l[N], r[N], w[N];
vector<int> b;
int pref[N];
void legenda_ne_umret() {
cin >> n >> m;
b.pb(0);
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (i > 1) {
int cur = a[i] - a[i - 1];
if (cur >= 0) {
b.pb(1);
}
else b.pb(0);
}
pref[b.sz] = pref[b.sz - 1] + b.back();
}
/*for(auto i :b) cout << i << ' ';
cout << '\n';
*/for (int i = 1; i <= m; i++) {
cin >> l[i] >> r[i] >> w[i];
if (pref[r[i]] - pref[l[i]] == r[i] - l[i]) {
cout << 1;
}
else {
cout << 0;
//cout << pref[r[i]] << ' ' << pref[l[i]] << '\n';
}
cout << '\n';
}
}
signed main() {
IOI;
//freopen("haybales.in", "r", stdin);
//freopen("haybales.out", "w", stdout);
///////////////////////////////////////////
int t = 1;
//cin >> t;
for (int i = 1; i <= t; i++) {
//cout << "Case " << i << ":\n";
legenda_ne_umret();
cout << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
361 ms |
49448 KB |
Output is correct |
2 |
Correct |
367 ms |
49440 KB |
Output is correct |
3 |
Correct |
399 ms |
49496 KB |
Output is correct |
4 |
Correct |
377 ms |
49380 KB |
Output is correct |
5 |
Correct |
380 ms |
72568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
15264 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |