結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-03-31 14:34:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 2,462 ms |
コンパイル使用メモリ | 198,712 KB |
最終ジャッジ日時 | 2025-02-20 17:18:47 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N, Q; cin >> N >> Q; vector<int> A(N+1); for (int i=1; i <= N; ++i) cin >> A[i]; vector<int> B = A; B.erase(B.begin()); sort(B.begin(), B.end()); while (Q--) { int x, y; cin >> x >> y; auto const t = lower_bound(B.begin(), B.end(), A[x]) - upper_bound(B.begin(), B.end(), A[y]); cout << max<int>(t, 0) << '\n'; } }