結果

問題 No.905 Sorted?
ユーザー ngtkanangtkana
提出日時 2020-03-09 12:26:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 1,663 ms
コンパイル使用メモリ 164,348 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 10:19:14
合計ジャッジ時間 5,022 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 7 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 127 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 192 ms
5,376 KB
testcase_12 AC 218 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 213 ms
5,376 KB
testcase_16 AC 236 ms
5,376 KB
testcase_17 AC 233 ms
5,376 KB
testcase_18 AC 174 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(int 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