結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-03-31 14:00:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 621 bytes |
コンパイル時間 | 1,472 ms |
コンパイル使用メモリ | 174,316 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-30 18:47:27 |
合計ジャッジ時間 | 4,819 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 12 |
ソースコード
#include <bits/stdc++.h> using ll=long long; const long long INF=1LL<<60; void Compress(std::vector<ll>& A) { std::vector<ll> B=A;// std::sort(B.begin(),B.end()); B.erase(std::unique(B.begin(),B.end()),B.end()); for(auto& a:A){ a=static_cast<ll>(std::lower_bound(B.begin(),B.end(),a)-B.begin()); } } int main(){ ll n,q; std::cin >> n >> q; std::vector<ll>A(n); for(auto&a:A){ std::cin >> a; a*=-1; } Compress(A); while(q--){ ll x,y; std::cin >> x >> y; --x;--y; std::cout << std::max(0LL,A[y]-A[x]-1) << '\n'; } }