提出 #72370173
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
int main(void){
long long n, q;
cin >> n >> q;
vector<long long> a(n);
for(long long i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
for(long long i = 0; i < q; i++){
long long x, y;
cin >> x >> y;
long long t = lower_bound(a.begin(), a.end(), x) - a.begin();
long long h = lower_bound(a.begin(), a.end(), x+y-1+(n-t)) - a.begin();
long long l = lower_bound(a.begin(), a.end(), x+y-1+h-t) - a.begin();
cout << x + y - t - 1 + l << endl;
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Forbidden List 2 |
| ユーザ | mrkm1627 |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 0 |
| コード長 | 613 Byte |
| 結果 | WA |
| 実行時間 | 428 ms |
| メモリ | 5780 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 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 | 3484 KiB |
| 00-sample-02.txt | AC | 1 ms | 3584 KiB |
| 01-01.txt | AC | 10 ms | 3444 KiB |
| 01-02.txt | AC | 10 ms | 3548 KiB |
| 01-03.txt | AC | 10 ms | 3592 KiB |
| 01-04.txt | AC | 10 ms | 3420 KiB |
| 01-05.txt | AC | 6 ms | 3568 KiB |
| 01-06.txt | WA | 6 ms | 3712 KiB |
| 01-07.txt | AC | 6 ms | 3524 KiB |
| 01-08.txt | WA | 6 ms | 3484 KiB |
| 01-09.txt | WA | 6 ms | 3664 KiB |
| 01-10.txt | WA | 5 ms | 3584 KiB |
| 01-11.txt | WA | 5 ms | 3784 KiB |
| 01-12.txt | WA | 6 ms | 3568 KiB |
| 01-13.txt | WA | 279 ms | 5716 KiB |
| 01-14.txt | WA | 408 ms | 5772 KiB |
| 01-15.txt | WA | 428 ms | 5772 KiB |
| 01-16.txt | WA | 225 ms | 4280 KiB |
| 01-17.txt | WA | 393 ms | 5556 KiB |
| 01-18.txt | WA | 304 ms | 4816 KiB |
| 01-19.txt | WA | 350 ms | 5780 KiB |
| 01-20.txt | WA | 284 ms | 5724 KiB |