結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-03-31 14:33:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 3,164 ms |
コンパイル使用メモリ | 255,504 KB |
実行使用メモリ | 13,056 KB |
最終ジャッジ日時 | 2024-09-30 19:40:31 |
合計ジャッジ時間 | 6,583 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 12 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; //B(n,V<int>(n)) int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,q; cin>>n>>q; V<int> A(n); set<int> s; rep(i,n){ cin>>A[i]; s.insert(A[i]); } map<int,int> m; int now=0; for(auto x:s) m[x]=now++; while(q--){ int x,y; cin>>x>>y; x--,y--; cout<<max(0,m[A[x]]-m[A[y]]-1)<<endl; } return 0; }