結果

問題 No.2517 Right Triangles on Circle
ユーザー take000take000
提出日時 2023-10-27 23:17:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 1,889 ms
コンパイル使用メモリ 208,688 KB
実行使用メモリ 19,624 KB
最終ジャッジ日時 2023-10-27 23:17:58
合計ジャッジ時間 5,654 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 215 ms
19,552 KB
testcase_15 AC 214 ms
19,552 KB
testcase_16 AC 145 ms
19,552 KB
testcase_17 AC 164 ms
16,648 KB
testcase_18 AC 173 ms
15,856 KB
testcase_19 AC 133 ms
14,272 KB
testcase_20 AC 130 ms
14,536 KB
testcase_21 AC 210 ms
19,552 KB
testcase_22 AC 44 ms
7,672 KB
testcase_23 AC 140 ms
15,064 KB
testcase_24 AC 56 ms
8,728 KB
testcase_25 AC 35 ms
6,880 KB
testcase_26 AC 178 ms
16,912 KB
testcase_27 AC 41 ms
7,408 KB
testcase_28 AC 21 ms
5,608 KB
testcase_29 AC 54 ms
8,464 KB
testcase_30 AC 35 ms
6,352 KB
testcase_31 AC 143 ms
15,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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<ll> st;
    rep(i, N) {
        st.insert(A[i]);

        ll rev = (A[i] + M) % (2 * M);
        if (st.find(rev) != st.end()) {
            ans += (ll)i - 1 + cnt;
            cnt++;
        } else {
            ans += cnt;
        }
    }
    cout << ans << "\n";

    return 0;
}
0