結果

問題 No.2517 Right Triangles on Circle
ユーザー achapiachapi
提出日時 2023-10-27 22:12:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 206,100 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-10-27 22:12:36
合計ジャッジ時間 5,259 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 129 ms
4,388 KB
testcase_14 AC 92 ms
4,388 KB
testcase_15 AC 158 ms
4,388 KB
testcase_16 AC 152 ms
4,388 KB
testcase_17 AC 112 ms
4,388 KB
testcase_18 AC 105 ms
4,348 KB
testcase_19 AC 91 ms
4,348 KB
testcase_20 AC 93 ms
4,348 KB
testcase_21 AC 136 ms
4,388 KB
testcase_22 AC 33 ms
4,348 KB
testcase_23 AC 108 ms
4,348 KB
testcase_24 AC 53 ms
4,348 KB
testcase_25 AC 29 ms
4,348 KB
testcase_26 AC 133 ms
4,388 KB
testcase_27 AC 31 ms
4,348 KB
testcase_28 AC 23 ms
4,348 KB
testcase_29 AC 51 ms
4,348 KB
testcase_30 AC 30 ms
4,348 KB
testcase_31 AC 113 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	if (M % 2 == 1){
		cout << 0 << endl;
		return 0;
	}
	sort(A.begin(), A.end());
	long long ans = 0;
	for (int i = 0; i < N; i++){
		auto it = lower_bound(A.begin(), A.end(), A[i] + M / 2);
		if (it != A.end() and *it == A[i] + M / 2){
			ans += N - 2;
		}
	}
	cout << ans << endl;
}
0