結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-03-31 14:36:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 4,017 ms |
コンパイル使用メモリ | 233,824 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-30 19:45:19 |
合計ジャッジ時間 | 6,866 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 11 |
ソースコード
#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]; priority_queue<P,vector<P>,greater<P>> pq; rep(i,n)pq.push({a[i],i}); vector<int> pos(n); int cnt=0; while(!pq.empty()){ P p=pq.top();pq.pop(); pos[p.second]=cnt; cnt++; } rep(i,q){ int x,y;cin>>x>>y; x--;y--; cout<<max(0,pos[x]-pos[y]-1)<<endl; } }