結果

問題 No.878 Range High-Element Query
ユーザー tko919tko919
提出日時 2019-09-09 02:14:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,028 bytes
コンパイル時間 2,290 ms
コンパイル使用メモリ 178,864 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-09 22:59:28
合計ジャッジ時間 12,535 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,752 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1,818 ms
4,376 KB
testcase_12 AC 1,150 ms
4,380 KB
testcase_13 AC 1,202 ms
4,376 KB
testcase_14 AC 743 ms
4,376 KB
testcase_15 AC 1,142 ms
4,376 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,q; scanf("%d%d",&n,&q);
    int a[100010];
    rep(i,1,n+1)scanf("%d",&a[i]);
    int tmp,l,r,cnt,maxx;
    rep(rot,0,q){
        scanf("%d%d%d",&tmp,&l,&r);
        cnt=0; maxx=0;
        rep(i,l,r+1)if(chmax(maxx,a[i]))cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}
0