結果
問題 | No.2710 How many more? |
ユーザー |
![]() |
提出日時 | 2024-03-31 20:43:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 281 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 1,983 ms |
コンパイル使用メモリ | 197,308 KB |
最終ジャッジ日時 | 2025-02-20 18:20:35 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> #ifdef LOCAL #include "./debug.cpp" #else #define debug(...) #define print_line #endif using namespace std; using ll = long long; int main() { int N, Q; cin >> N >> Q; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector<int> B = A; sort(B.begin(), B.end()); while (Q--) { int x, y; cin >> x >> y; x--; y--; int ans = lower_bound(B.begin(), B.end(), A[x]) - lower_bound(B.begin(), B.end(), A[y] + 1); cout << max(0, ans) << '\n'; } }