結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 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 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 221 ms
19,596 KB
testcase_15 AC 217 ms
19,596 KB
testcase_16 AC 147 ms
19,596 KB
testcase_17 AC 169 ms
16,692 KB
testcase_18 AC 183 ms
15,900 KB
testcase_19 AC 139 ms
14,316 KB
testcase_20 AC 134 ms
14,580 KB
testcase_21 AC 212 ms
19,596 KB
testcase_22 AC 44 ms
7,716 KB
testcase_23 AC 144 ms
15,108 KB
testcase_24 AC 58 ms
8,772 KB
testcase_25 AC 36 ms
6,924 KB
testcase_26 AC 180 ms
16,956 KB
testcase_27 AC 42 ms
7,452 KB
testcase_28 AC 23 ms
5,644 KB
testcase_29 AC 66 ms
8,508 KB
testcase_30 AC 30 ms
6,396 KB
testcase_31 AC 143 ms
15,168 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);
        ans += cnt;
        if (st.find(rev) != st.end()) {
            ans += i - 1;
            cnt++;
        }
    }
    cout << ans << "\n";

    return 0;
}
0