結果
問題 |
No.2517 Right Triangles on Circle
|
ユーザー |
|
提出日時 | 2023-10-27 23:15:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 2,047 ms |
コンパイル使用メモリ | 199,792 KB |
最終ジャッジ日時 | 2025-02-17 15:55:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 1 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); ll N, M; cin >> N >> M; vector<ll> A(N); rep(i, N) cin >> A[i], A[i] *= 2; ll ans = 0, cnt = 0; set<int> st; rep(i, N) { st.insert(A[i]); int rev = (A[i] + M) % (2 * M); if (st.find(rev) != st.end()) { ans += cnt + i - 1; cnt++; } else { ans += cnt; } } cout << ans << "\n"; return 0; }