結果
問題 | No.905 Sorted? |
ユーザー |
![]() |
提出日時 | 2019-10-17 03:12:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 772 bytes |
コンパイル時間 | 2,086 ms |
コンパイル使用メモリ | 178,620 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-06-23 13:08:36 |
合計ジャッジ時間 | 6,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 TLE * 1 -- * 14 |
ソースコード
#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; }