結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 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 1 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 218 ms
18,564 KB
testcase_15 WA -
testcase_16 AC 147 ms
18,564 KB
testcase_17 AC 171 ms
15,660 KB
testcase_18 AC 155 ms
14,868 KB
testcase_19 AC 140 ms
13,548 KB
testcase_20 AC 137 ms
13,812 KB
testcase_21 AC 217 ms
18,300 KB
testcase_22 AC 40 ms
7,500 KB
testcase_23 AC 144 ms
14,340 KB
testcase_24 WA -
testcase_25 AC 36 ms
6,904 KB
testcase_26 AC 186 ms
16,188 KB
testcase_27 AC 41 ms
7,256 KB
testcase_28 AC 21 ms
5,668 KB
testcase_29 AC 53 ms
8,268 KB
testcase_30 AC 30 ms
6,400 KB
testcase_31 AC 144 ms
14,076 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);

    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++;
        } else {
            ans += cnt;
        }
    }
    cout << ans << "\n";

    return 0;
}
0