結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-16 16:14:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 481 bytes |
| コンパイル時間 | 1,298 ms |
| コンパイル使用メモリ | 163,076 KB |
| 実行使用メモリ | 814,076 KB |
| 最終ジャッジ日時 | 2024-09-24 23:14:47 |
| 合計ジャッジ時間 | 4,270 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 RE * 1 MLE * 1 -- * 10 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(){
int n, x, ans = 0;
cin >> n >> x;
vector<int> a(n);
rep(i,n) cin >> a.at(i);
sort(a.begin(), a.end());
vector<int> b(x+1);
for(int i = 0; i < n && a.at(i) < x+1; ++i){
++b.at(a.at(i));
}
for(int i = 0; i <= x; ++i){
ans += b.at(i) * b.at(x-i);
}
cout << ans << endl;
return 0;
}