답안 #499750

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499750 2021-12-29T11:58:27 Z The_Samurai Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++
13 / 100
495 ms 30144 KB
#include <bits/stdc++.h>
#define fcc ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define sqr(a) (a) * (a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rebgin(), x.rend()
#define pb push_back
#define mp make_pair
#define int long long
#define ff first
#define ss second
#define endl "\n"
using namespace std;

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
int a[500009], b[500009];

void solve() {
	int n, m, l, r, k;
	
	cin >> n >> m;
	int a[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	a[0] = 0;
	int dp[n + 1];
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i] = dp[i - 1];
		if (a[i] < a[i - 1]) {
			dp[i]++;
		}
	}
	// 9 9 4 2 3 5
	//
	while (m--) {
		cin >> l >> r >> k;
		if (dp[r] - dp[l] == 0) {
			cout << "1\n";
		}
		else {
			cout << "0\n";
		}
	}
}

signed main() {
	fcc;
    int t = 1;
    
//    cin >> t;
    while (t--) {
    	solve();
    	cout << '\n';
  	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 495 ms 28684 KB Output is correct
2 Correct 472 ms 30108 KB Output is correct
3 Correct 454 ms 30104 KB Output is correct
4 Correct 441 ms 30144 KB Output is correct
5 Correct 473 ms 30096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 2248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -