結果

問題 No.2710 How many more?
ユーザー VvyLw
提出日時 2024-03-31 15:16:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 108,632 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-30 20:30:35
合計ジャッジ時間 2,987 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    int n, q;
    std::cin >> n >> q;
    std::vector<int> a(n), b;
    for(auto &el: a) {
        std::cin >> el;
    }
    b = a;
    std::ranges::sort(b);
    while(q--) {
        int x, y;
        std::cin >> x >> y;
        x--, y--;
        std::cout << std::max(0L, std::ranges::upper_bound(b, a[x]) - std::ranges::upper_bound(b, a[y]) - 1) << '\n';
    }
}
0