結果

問題 No.1240 Or Sum of Xor Pair
ユーザー chineristAC
提出日時 2020-08-22 23:25:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 2,622 ms
コンパイル使用メモリ 193,312 KB
最終ジャッジ日時 2025-01-13 11:58:10
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 13 TLE * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |     scanf("%lld",&N);
      |     ~~~~~^~~~~~~~~~~
main.cpp:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     scanf("%lld",&X);
      |     ~~~~~^~~~~~~~~~~
main.cpp:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |         scanf("%lld",&A[i]);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<random>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
using P=pair<ll,ll>;

int main(){
    ll N,X;
    scanf("%lld",&N);
    scanf("%lld",&X);
    vector<ll> A(N);
    for (ll i=0;i<N;i++){
        scanf("%lld",&A[i]);
    }
    ll res=0;
    for (ll i=1;i<N;i++){
        for (ll j=0;j<i;j++){
            if ((A[i]^A[j])<X){
                res+=A[i]^A[j];
            }
        }
    }
    cout<<res<<endl;
}
0