結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-23 10:32:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 249 bytes |
| コンパイル時間 | 854 ms |
| コンパイル使用メモリ | 69,504 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 17:05:03 |
| 合計ジャッジ時間 | 3,090 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 2 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int n,x,a[1<<17];
main(){
cin>>n>>x;
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
int c=0;
for(int i=0;i<n;i++)c+=upper_bound(a,a+n,x-a[i])-lower_bound(a,a+n,x-a[i]);
cout<<c<<endl;
}