結果
| 問題 | 
                            No.723 2つの数の和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kyabaria
                         | 
                    
| 提出日時 | 2018-09-09 13:06:52 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 401 bytes | 
| コンパイル時間 | 1,693 ms | 
| コンパイル使用メモリ | 158,812 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-23 06:11:08 | 
| 合計ジャッジ時間 | 4,079 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 WA * 2 RE * 9 | 
ソースコード
#include <bits/stdc++.h>
typedef unsigned long long ll;
#define INF 1000000000
using namespace std;
#define N 100000
int main(void){
    int n,x;
    cin>>n>>x;
    int cnt[N+5]={0};
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        cnt[a[i]]++;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(x-a[i]<0)continue;
        ans+=cnt[x-a[i]];
    }
    cout<<ans<<endl;
}
            
            
            
        
            
kyabaria