結果

問題 No.905 Sorted?
ユーザー B0_0LB0_0L
提出日時 2019-10-11 21:55:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 165,772 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-08-16 17:43:11
合計ジャッジ時間 7,482 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 81 ms
4,376 KB
testcase_06 AC 13 ms
4,376 KB
testcase_07 AC 1,809 ms
4,380 KB
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
  int n;cin >> n;
  int a[n];rep(i,n)cin >> a[i];
  int q;cin >> q;
  int l[q],r[q];
  rep(i,q)cin >> l[i] >> r[i];
  rep(k,q){
    int no = 0;
    for(int i=l[k];i<r[k];++i){
      for(int j=i+1;j<=r[k];++j){
        if(a[i] > a[j]){no = 1;break;}
      }
    }
    if(no == 1){cout << 0 << " ";}
    else cout << 1 << " ";
    no = 0;
    for(int i=l[k];i<r[k];++i){
      for(int j=i+1;j<=r[k];++j){
        if(a[i] < a[j]){no = 1;break;}
      }
    }
    if(no == 1){cout << 0 << endl;}
    else cout << 1 << endl;
  }
  return 0;
}
0