結果

問題 No.905 Sorted?
ユーザー m1025o1184tm1025o1184t
提出日時 2019-10-17 03:12:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 772 bytes
コンパイル時間 1,640 ms
コンパイル使用メモリ 175,000 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2023-09-05 17:39:30
合計ジャッジ時間 7,015 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,756 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 12 ms
4,376 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 56 ms
4,376 KB
testcase_08 TLE -
testcase_09 -- -
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;
typedef long long ll;
typedef pair<int, int> P;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	int q;
	cin >> q;
	vector<P> l(q);
	vector<P> query(q);
	rep(i, q) cin >> l[i].first >> l[i].second;
	rep(i, q) {
		vector<ll> res;
		for (int j = l[i].first; j <= l[i].second; ++j) {
			res.push_back(a[j]);

		}
		vector<ll> sol=res;
		sort(sol.begin(), sol.end());
		if (sol == res) query[i].first = 1;
		else query[i].first = 0;
		reverse(sol.begin(), sol.end());
		if (sol == res) query[i].second = 1;
		else query[i].second = 0;
	}
	rep(i, q) cout << query[i].first << ' ' << query[i].second << endl;
	return 0;
}
0