結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
dsaito11
|
| 提出日時 | 2019-07-27 11:54:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 665 bytes |
| コンパイル時間 | 735 ms |
| コンパイル使用メモリ | 88,724 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-02 10:49:45 |
| 合計ジャッジ時間 | 2,004 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 6 WA * 16 |
ソースコード
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
int main() {
int n, x;
cin >> n >> x;
vector<int> a(n);
int i;
for(i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
long long int ans = 0;
for(i = 0; i < n; i++){
ans += lower_bound(a.begin(), a.end(), x-a[i]) - upper_bound(a.begin(), a.end(), x-a[i]);
}
cout << ans << endl;
}
dsaito11