結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long A[100005];  

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 i = 1; i <= N; i++) {
                if (A[y] < A[i] && A[i] < A[x]) cnt++;
            }
            cout << cnt << "\n";
        }
    }
    return 0;
}
0