結果

問題 No.905 Sorted?
ユーザー ngtkanangtkana
提出日時 2020-03-09 12:31:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 1,561 ms
コンパイル使用メモリ 164,508 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 10:20:23
合計ジャッジ時間 5,305 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 7 ms
5,376 KB
testcase_08 AC 189 ms
5,376 KB
testcase_09 AC 111 ms
5,376 KB
testcase_10 AC 179 ms
5,376 KB
testcase_11 AC 175 ms
5,376 KB
testcase_12 AC 200 ms
5,376 KB
testcase_13 AC 211 ms
5,376 KB
testcase_14 AC 208 ms
5,376 KB
testcase_15 AC 204 ms
5,376 KB
testcase_16 AC 223 ms
5,376 KB
testcase_17 AC 218 ms
5,376 KB
testcase_18 AC 162 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define endl enjoy_codeforces
int main(){
    int n;std::cin>>n;
    std::vector<int>a(n),b(n);
    for(long long i=0,prv,crr;i<n;i++){
        std::cin>>crr;
        if(0<i){
            a.at(i)=a.at(i-1)+(prv<=crr);
            b.at(i)=b.at(i-1)+(prv>=crr);
        }
        prv=crr;
    }
    int q;std::cin>>q;
    while(q--){
        int l,r;std::cin>>l>>r;
        std::cout<<(a.at(r)-a.at(l)==r-l)<<" "<<(b.at(r)-b.at(l)==r-l)<<'\n';
    }
}
0