結果

問題 No.723 2つの数の和
ユーザー masamasa
提出日時 2019-01-25 11:05:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 61,292 KB
実行使用メモリ 7,788 KB
最終ジャッジ日時 2023-10-14 09:47:51
合計ジャッジ時間 1,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,236 KB
testcase_01 AC 3 ms
7,276 KB
testcase_02 AC 3 ms
7,272 KB
testcase_03 AC 22 ms
7,600 KB
testcase_04 AC 28 ms
7,680 KB
testcase_05 AC 26 ms
7,576 KB
testcase_06 AC 28 ms
7,596 KB
testcase_07 AC 14 ms
7,452 KB
testcase_08 AC 16 ms
7,708 KB
testcase_09 AC 28 ms
7,624 KB
testcase_10 AC 14 ms
7,424 KB
testcase_11 AC 6 ms
7,284 KB
testcase_12 AC 18 ms
7,448 KB
testcase_13 AC 29 ms
7,784 KB
testcase_14 AC 10 ms
7,368 KB
testcase_15 AC 14 ms
7,416 KB
testcase_16 AC 20 ms
7,516 KB
testcase_17 AC 24 ms
7,664 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
7,232 KB
testcase_21 AC 4 ms
7,260 KB
testcase_22 AC 4 ms
7,348 KB
testcase_23 AC 30 ms
7,628 KB
testcase_24 AC 11 ms
7,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
using namespace std;
template<class T> bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;}
template<class T> int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}}
template<class T> bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int main(void){
    int N;
    long X;
    cin >> N >> X;
    int aCount[1000001] = {};
    int a[N];
    int count = 0;
    
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        aCount[tmp]++;
    }
    
    for (int i = 0; i < N; i++) {
        long target = X - a[i];
        if (target < 0 || target > 1000001) continue;
        count += aCount[X - a[i]];
    }
   
    
    cout << count << endl;
}
0