結果

問題 No.905 Sorted?
ユーザー okok
提出日時 2019-10-11 21:36:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 904 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 83,448 KB
実行使用メモリ 5,500 KB
最終ジャッジ日時 2023-08-16 17:20:32
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 32 ms
4,380 KB
testcase_09 AC 20 ms
4,376 KB
testcase_10 AC 35 ms
5,108 KB
testcase_11 AC 31 ms
4,912 KB
testcase_12 AC 34 ms
4,668 KB
testcase_13 AC 40 ms
5,424 KB
testcase_14 AC 41 ms
5,500 KB
testcase_15 AC 33 ms
5,424 KB
testcase_16 AC 37 ms
5,484 KB
testcase_17 AC 37 ms
5,376 KB
testcase_18 AC 29 ms
5,368 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,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, Q;
	vector<int> A, con1, con2;
	
	cin>>N;
	
	A.resize(N);
	con1.resize(N, 1);
	con2.resize(N, 1);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
		if(i && A[i-1] <= A[i]) con1[i] = con1[i-1] + 1;
		if(i && A[i-1] >= A[i]) con2[i] = con2[i-1] + 1;
	}
	
	cin>>Q;
	
	for(int i = 0; i < Q; i++){
		int l, r;
		bool f1 = false, f2 = false;
		
		cin>>l>>r;
		
		if(r-con1[r]+1 <= l) f1 = true;
		if(r-con2[r]+1 <= l) f2 = true;
		
		cout<<f1<<" "<<f2<<endl;
	}
	
	return 0;
}
0