結果

問題 No.905 Sorted?
ユーザー furafura
提出日時 2020-05-05 18:06:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 2,441 ms
コンパイル使用メモリ 200,688 KB
実行使用メモリ 5,692 KB
最終ジャッジ日時 2023-09-09 05:52:32
合計ジャッジ時間 5,016 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 37 ms
4,380 KB
testcase_09 AC 24 ms
4,376 KB
testcase_10 AC 40 ms
5,444 KB
testcase_11 AC 36 ms
5,192 KB
testcase_12 AC 40 ms
4,740 KB
testcase_13 AC 46 ms
5,528 KB
testcase_14 AC 47 ms
5,500 KB
testcase_15 AC 41 ms
5,440 KB
testcase_16 AC 44 ms
5,536 KB
testcase_17 AC 44 ms
5,692 KB
testcase_18 AC 34 ms
5,356 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	vector<lint> inc(n+1),dec(n+1);
	rep(i,n){
		inc[i+1]=inc[i]+(a[i]<=a[i+1]?1:0);
		dec[i+1]=dec[i]+(a[i]>=a[i+1]?1:0);
	}

	int q; scanf("%d",&q);
	rep(_,q){
		int l,r; scanf("%d%d",&l,&r);
		printf("%d %d\n",inc[r]-inc[l]==r-l?1:0,dec[r]-dec[l]==r-l?1:0);
	}

	return 0;
}
0