結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-11-08 20:55:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 878 bytes |
コンパイル時間 | 1,052 ms |
コンパイル使用メモリ | 98,488 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 21:09:09 |
合計ジャッジ時間 | 1,949 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 13 |
ソースコード
#include <stdio.h> #include <algorithm> #include <iostream> #include <string> #include <vector> #include <functional> #include <map> #include <iomanip> #include <math.h> #include <stack> #include <queue> #include <bitset> #include <cstdlib> #include <tuple> #include <cctype> #include <ctype.h> #include <set> #include <sstream> using namespace std; int main(){ int i, j, k; long long n, x; vector<bool>flag(100009, false); vector<long long>list; long cnt2 = 0; cin >> n >> x; for (i = 0; i < n; i++) { long long num; cin >> num; if ( (x - num > 100000) || (x - num < 0)) { } else { if (flag[x - num] == true) cnt2++; flag[x - num] = true; } list.push_back(num); } long long cnt = 0; for (i = 0; i < n; i++) { if (flag[list[i]] == true) { cnt++; } } cout << cnt + cnt2 << endl; getchar(); getchar(); return 0; }