結果
| 問題 |
No.905 Sorted?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-11 21:29:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 227 ms / 2,000 ms |
| コード長 | 559 bytes |
| コンパイル時間 | 697 ms |
| コンパイル使用メモリ | 65,388 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 06:45:43 |
| 合計ジャッジ時間 | 3,681 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include <iostream>
using namespace std;
int main(){
int n;cin>>n;
long long a[n];
for(int i = 0; n > i; i++)cin>>a[i];
int b[n];
int c[n];
b[0]=0;//広義単調増加
c[0]=0;//広義単調減少
for(int i = 1; n > i; i++){
if(a[i-1] < a[i]) c[i] = i;
else c[i] = c[i-1];
if(a[i-1] > a[i]) b[i] = i;
else b[i] = b[i-1];
}
int q;cin>>q;
for(int i = 0; q > i; i++){
int l,r;cin>>l>>r;
if(b[r] > l)cout << 0;
else cout << 1;
cout << " ";
if(c[r] > l)cout << 0;
else cout << 1;
cout << endl;
}
}