結果
| 問題 | No.2517 Right Triangles on Circle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-26 11:23:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| + 403µs | |
| コード長 | 709 bytes |
| 記録 | |
| コンパイル時間 | 2,063 ms |
| コンパイル使用メモリ | 338,248 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-25 04:14:30 |
| 合計ジャッジ時間 | 4,987 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}