結果

問題 No.2517 Right Triangles on Circle
ユーザー take000take000
提出日時 2023-10-27 22:06:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 207,888 KB
実行使用メモリ 18,524 KB
最終ジャッジ日時 2023-10-27 22:07:00
合計ジャッジ時間 6,350 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 306 ms
18,524 KB
testcase_15 WA -
testcase_16 AC 180 ms
18,524 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 44 ms
7,460 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 39 ms
6,864 KB
testcase_26 WA -
testcase_27 AC 44 ms
7,216 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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);

    int N, M;
    cin >> N >> M;
    vector<int> 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 += i - 1 + cnt;
            cnt++;
        }
    }
    cout << ans << "\n";

    return 0;
}
0