結果

問題 No.723 2つの数の和
ユーザー sigmanisigmani
提出日時 2022-02-22 20:51:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 1,918 ms
コンパイル使用メモリ 172,408 KB
実行使用メモリ 11,948 KB
最終ジャッジ日時 2023-09-13 11:39:11
合計ジャッジ時間 5,367 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 62 ms
9,380 KB
testcase_04 AC 82 ms
10,268 KB
testcase_05 AC 74 ms
10,500 KB
testcase_06 AC 77 ms
10,192 KB
testcase_07 AC 35 ms
7,432 KB
testcase_08 AC 40 ms
7,876 KB
testcase_09 AC 84 ms
11,156 KB
testcase_10 AC 33 ms
6,980 KB
testcase_11 AC 8 ms
4,412 KB
testcase_12 AC 45 ms
8,452 KB
testcase_13 AC 87 ms
11,948 KB
testcase_14 AC 20 ms
6,056 KB
testcase_15 AC 35 ms
7,884 KB
testcase_16 AC 54 ms
9,660 KB
testcase_17 AC 74 ms
10,968 KB
testcase_18 AC 15 ms
4,380 KB
testcase_19 AC 31 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 70 ms
10,592 KB
testcase_24 AC 26 ms
6,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
long long X;
cin>>X;
long long A[202020];
for(int i=1;i<=N;i++)cin>>A[i];
map<long long ,long long>Map;
for(int i=1;i<=N;i++)Map[A[i]]++;
long long count=0;
for(int i=1;i<=N;i++){
  count=count+Map[X-A[i]];
}
cout<<count;
return 0;


}
0