結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,108 KB
testcase_01 AC 3 ms
7,240 KB
testcase_02 AC 3 ms
7,108 KB
testcase_03 AC 22 ms
7,388 KB
testcase_04 AC 28 ms
7,492 KB
testcase_05 AC 26 ms
7,440 KB
testcase_06 AC 26 ms
7,732 KB
testcase_07 AC 14 ms
7,404 KB
testcase_08 AC 15 ms
7,504 KB
testcase_09 AC 28 ms
7,656 KB
testcase_10 AC 14 ms
7,264 KB
testcase_11 AC 6 ms
7,256 KB
testcase_12 AC 17 ms
7,428 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
7,216 KB
testcase_21 AC 3 ms
7,256 KB
testcase_22 AC 4 ms
7,252 KB
testcase_23 AC 29 ms
7,620 KB
testcase_24 AC 11 ms
7,244 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 = 1; i <= N; i++) {
        int target = X - a[i-1];
        if (target < 0) continue;
        count += aCount[target];
    }
   
    
    cout << count << endl;
}
0