結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
suzuken_w
|
| 提出日時 | 2019-10-01 14:19:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 694 bytes |
| コンパイル時間 | 1,435 ms |
| コンパイル使用メモリ | 179,192 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2024-10-03 05:41:09 |
| 合計ジャッジ時間 | 3,500 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
map<int,int> mp;
int main(){
int n,m;
cin>>n>>m;
vector<ll> a(n);
for(int i=0;i<n;i++){
cin>>a[i];
mp[a[i]]++;
}
ll ans=0;
for(int i=0;i<n;i++){
ll tmp=m-a[i];
if(tmp==a[i]) ans+=mp[a[i]]*mp[a[i]];
else ans+=mp[tmp]*mp[a[i]]*2;
mp[a[i]]=0;mp[tmp]=0;
}
cout<<ans<<endl;
}
suzuken_w