結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
xxxasdfghjk
|
| 提出日時 | 2018-08-12 13:20:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 773 ms |
| コンパイル使用メモリ | 82,536 KB |
| 実行使用メモリ | 11,648 KB |
| 最終ジャッジ日時 | 2024-09-24 07:06:32 |
| 合計ジャッジ時間 | 3,296 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 3 |
ソースコード
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
return a.second < b.second;
}
int main()
{
ll N,X,res=0;
cin >> N >> X;
vector<ll> a(N+1);
map<ll,ll> mp;
REP(i,N){
cin >> a[i];
mp[a[i]]++;
if(X - a[i] == a[i])
res += mp[X-a[i]];
else
res += 2*mp[X-a[i]];
}
cout << res << endl;
return 0;
}
xxxasdfghjk