結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
|
提出日時 | 2024-11-16 15:36:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 1,777 ms |
コード長 | 599 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 198,628 KB |
最終ジャッジ日時 | 2025-02-25 04:23:20 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int R, n; cin >> R >> n; vector<int> a(n); for(auto &&v : a) cin >> v; sort(a.begin(), a.end()); int Q; cin >> Q; while(Q--){ int l, r; cin >> l >> r; int pl = l / R, pr = r / R; l %= R, r %= R; ll L = lower_bound(a.begin(), a.end(), l) - a.begin(); ll R = upper_bound(a.begin(), a.end(), r) - a.begin(); L += pl * (ll)(n), R += pr * (ll)(n); cout << R - L << '\n'; } }