結果

問題 No.905 Sorted?
ユーザー cotton_fn_cotton_fn_
提出日時 2020-02-03 13:59:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 123,028 KB
実行使用メモリ 4,420 KB
最終ジャッジ日時 2023-10-19 01:44:03
合計ジャッジ時間 4,016 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 7 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 122 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 186 ms
4,420 KB
testcase_12 AC 214 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 209 ms
4,420 KB
testcase_16 AC 226 ms
4,420 KB
testcase_17 AC 224 ms
4,420 KB
testcase_18 AC 168 ms
4,420 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), inc(n), dec(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 1; i < n; ++i) {
        inc[i] = (a[i] >= a[i - 1]) + inc[i - 1];
        dec[i] = (a[i] <= a[i - 1]) + dec[i - 1];
    }
    int q;
    cin >> q;
    while (q--) {
        int l, r;
        cin >> l >> r;
        cout << (inc[r] - inc[l] == r - l) << ' ';
        cout << (dec[r] - dec[l] == r - l) << '\n';
    }
    return 0;
}
// l     r
// 0, 1, 2
//   1  2
0