結果

問題 No.2710 How many more?
ユーザー vjudge1
提出日時 2025-09-05 00:05:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 510 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 194,876 KB
実行使用メモリ 15,940 KB
最終ジャッジ日時 2025-09-05 00:05:20
合計ジャッジ時間 6,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll A[100001];
int main() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) cin >> A[i];
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (A[x] <= A[y]) {
            cout << 0 << "\n";
        } else {
            int cnt = 0;
            for (int k = 1; k <= n; k++) {
                if (A[y] < A[k] && A[k] < A[x]) cnt++;
            }
            cout << cnt << "\n";
        }
    }
    return 0;
}
0