結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
![]() |
提出日時 | 2024-11-16 15:34:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 50 ms / 1,777 ms |
コード長 | 663 bytes |
コンパイル時間 | 4,099 ms |
コンパイル使用メモリ | 250,740 KB |
最終ジャッジ日時 | 2025-02-25 04:22:49 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL long long get(long long n,vector<long long> &sum){ long long res = 0; long long R = sum.size(); res = n/R * sum.back(); n %= R; res += sum[n]; return res; } int main(){ int R,N; cin>>R>>N; vector<long long> sum(R); rep(i,N){ int a; cin>>a; sum[a]++; } rep(i,R-1)sum[i+1] += sum[i]; int q; cin>>q; rep(_,q){ int l,r; cin>>l>>r; cout<<get(r,sum) - get(l-1,sum)<<endl; } return 0; }