結果
| 問題 | No.2710 How many more? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-03-31 15:16:23 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 489 bytes | 
| コンパイル時間 | 1,136 ms | 
| コンパイル使用メモリ | 108,740 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-09-30 20:29:57 | 
| 合計ジャッジ時間 | 3,187 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 6 WA * 11 | 
ソースコード
#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::lower_bound(b, a[x]) - std::ranges::lower_bound(b, a[y]) - 1) << '\n';
    }
}
            
            
            
        