結果
問題 |
No.905 Sorted?
|
ユーザー |
|
提出日時 | 2019-09-24 14:33:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 708 ms |
コンパイル使用メモリ | 66,640 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-10-03 05:51:50 |
合計ジャッジ時間 | 8,140 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 15 TLE * 2 -- * 6 |
ソースコード
// TLEになってほしい #include<iostream> #include<vector> using namespace std; typedef long long ll; ll a[100000]; int main(){ int n; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld", a+i); int q; scanf("%d", &q); while(q-- > 0){ int l, r; scanf("%d %d", &l, &r); bool asc = true, dec = true; l++; while(l <= r && (asc || dec)){ if(a[l-1] > a[l]) asc = false; if(a[l-1] < a[l]) dec = false; l++; } if(asc && dec) printf("0\n"); else if(asc) printf("1\n"); else if(dec) printf("-1\n"); else printf("2\n"); } return 0; }