結果
問題 | No.905 Sorted? |
ユーザー |
|
提出日時 | 2019-10-12 00:59:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 207 ms / 2,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 785 ms |
コンパイル使用メモリ | 65,016 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 22:55:45 |
合計ジャッジ時間 | 4,209 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; long A[1<<17]; int UP[1<<17],DW[1<<17]; main() { cin>>N; for(int i=0;i<N;i++)cin>>A[i]; UP[0]=DW[0]=0; for(int i=1;i<N;i++) { UP[i]=DW[i]=i; if(A[i-1]<=A[i])UP[i]=UP[i-1]; if(A[i-1]>=A[i])DW[i]=DW[i-1]; } int Q;cin>>Q; for(;Q--;) { int L,R;cin>>L>>R; cout<<(UP[R]<=L)<<" "<<(DW[R]<=L)<<endl; } }