結果
| 問題 | No.2710 How many more? |
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-03-31 20:43:09 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 160 ms / 2,000 ms |
| コード長 | 570 bytes |
| 記録 | |
| コンパイル時間 | 1,274 ms |
| コンパイル使用メモリ | 217,796 KB |
| 実行使用メモリ | 11,940 KB |
| 最終ジャッジ日時 | 2026-07-04 08:47:13 |
| 合計ジャッジ時間 | 4,003 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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';
}
}
Today03