結果
問題 | No.2710 How many more? |
ユーザー | mitani |
提出日時 | 2024-03-31 14:46:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 284 ms / 2,000 ms |
コード長 | 717 bytes |
コンパイル時間 | 4,279 ms |
コンパイル使用メモリ | 232,128 KB |
実行使用メモリ | 6,676 KB |
最終ジャッジ日時 | 2024-03-31 14:46:18 |
合計ジャッジ時間 | 8,336 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,676 KB |
testcase_01 | AC | 2 ms
6,676 KB |
testcase_02 | AC | 237 ms
6,676 KB |
testcase_03 | AC | 137 ms
6,676 KB |
testcase_04 | AC | 101 ms
6,676 KB |
testcase_05 | AC | 77 ms
6,676 KB |
testcase_06 | AC | 98 ms
6,676 KB |
testcase_07 | AC | 102 ms
6,676 KB |
testcase_08 | AC | 75 ms
6,676 KB |
testcase_09 | AC | 198 ms
6,676 KB |
testcase_10 | AC | 114 ms
6,676 KB |
testcase_11 | AC | 186 ms
6,676 KB |
testcase_12 | AC | 262 ms
6,676 KB |
testcase_13 | AC | 279 ms
6,676 KB |
testcase_14 | AC | 277 ms
6,676 KB |
testcase_15 | AC | 277 ms
6,676 KB |
testcase_16 | AC | 281 ms
6,676 KB |
testcase_17 | AC | 284 ms
6,676 KB |
testcase_18 | AC | 2 ms
6,676 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(x) x.begin(), x.end() using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; #include <atcoder/all> using namespace atcoder; //using mint=static_modint<998244353>; using mint=static_modint<1000000007>; ll n,q; vector<int> a; int main(){ cin>>n>>q; a.resize(n); rep(i,n)cin>>a[i]; vector<int> b(n); rep(i,n)b[i]=a[i]; sort(all(b)); rep(i,q){ int x,y;cin>>x>>y; x--;y--; auto it1=upper_bound(all(b),a[y]); auto it2=lower_bound(all(b),a[x]); int idx1=it1-b.begin(); int idx2=it2-b.begin(); cout<<max(0,idx2-idx1)<<endl; } }