提出 #72352783
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
int n,q;cin>>n>>q;
map<int,int>mp;vector<int>lis;
for(int i=0;i<n;i++){
int x;cin>>x;
if(!mp[x]) mp[x]=1,lis.push_back(x);
}
sort(lis.begin(),lis.end());
while(q--){
int x,y;cin>>x>>y;
int l=x,r=2e9;
while(l<r){
int mid=(l+r)>>1;
int l1=lower_bound(lis.begin(),lis.end(),x)-lis.begin();
int r1=upper_bound(lis.begin(),lis.end(),mid)-lis.begin()-1;
if(mid-x+1-(r1-l1+1)<y) l=mid+1;
else r=mid;
}
cout<<l<<"\n";
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Forbidden List 2 |
| ユーザ | dogger_of_V |
| 言語 | C++23 (Clang 21.1.0) |
| 得点 | 400 |
| コード長 | 625 Byte |
| 結果 | AC |
| 実行時間 | 1442 ms |
| メモリ | 24612 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3116 KiB |
| 00-sample-02.txt | AC | 1 ms | 3096 KiB |
| 01-01.txt | AC | 12 ms | 3148 KiB |
| 01-02.txt | AC | 14 ms | 3148 KiB |
| 01-03.txt | AC | 14 ms | 3052 KiB |
| 01-04.txt | AC | 13 ms | 2992 KiB |
| 01-05.txt | AC | 12 ms | 3360 KiB |
| 01-06.txt | AC | 14 ms | 3352 KiB |
| 01-07.txt | AC | 10 ms | 3184 KiB |
| 01-08.txt | AC | 12 ms | 3260 KiB |
| 01-09.txt | AC | 13 ms | 3208 KiB |
| 01-10.txt | AC | 11 ms | 3184 KiB |
| 01-11.txt | AC | 12 ms | 3248 KiB |
| 01-12.txt | AC | 13 ms | 3348 KiB |
| 01-13.txt | AC | 921 ms | 23900 KiB |
| 01-14.txt | AC | 1342 ms | 24596 KiB |
| 01-15.txt | AC | 1442 ms | 24532 KiB |
| 01-16.txt | AC | 510 ms | 11832 KiB |
| 01-17.txt | AC | 1326 ms | 24408 KiB |
| 01-18.txt | AC | 973 ms | 16904 KiB |
| 01-19.txt | AC | 944 ms | 24612 KiB |
| 01-20.txt | AC | 959 ms | 24000 KiB |