結果
| 問題 | No.2517 Right Triangles on Circle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-26 11:23:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 709 bytes |
| 記録 | |
| コンパイル時間 | 3,968 ms |
| コンパイル使用メモリ | 343,072 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-26 11:23:27 |
| 合計ジャッジ時間 | 7,303 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N, M;
cin >> N >> M;
vector<ll> A(N);
for (int i = 0; i < N; i++) cin >> A[i];
if (M % 2 == 1) {
cout << 0 << '\n';
return 0;
}
sort(A.begin(), A.end());
ll half = M / 2;
ll cnt = 0;
for (ll a : A) {
ll b = a + half;
if (b > M) b -= M; // mod M (1..M 表現)
if (binary_search(A.begin(), A.end(), b)) {
cnt++;
}
}
// 各直径の組を 2 回ずつ数えている
ll D = cnt / 2;
ll ans = D * (N - 2);
cout << ans << '\n';
return 0;
}