結果

問題 No.2517 Right Triangles on Circle
ユーザー MasKoaTSMasKoaTS
提出日時 2023-08-26 14:34:52
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 700 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 32,284 KB
実行使用メモリ 7,164 KB
最終ジャッジ日時 2023-08-28 18:44:22
合計ジャッジ時間 4,539 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//愚直解

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#define MAX_DATA 300000
#define ll long long

int main(void) {
    int n, m;
    scanf("%d", &n);    scanf("%d", &m);

    int a[MAX_DATA];
    for(int i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }

    if(m & 1){
        puts("0");
        return 0;
    }

    int cnt = 0;
    int h = m / 2;
    for(int i = 0; i < n - 1; ++i){
        for(int j = i + 1; j < n; ++j){
            int x = a[i] - a[j];
            if(x == h || x == -h){
                ++cnt;
            }
        }
    }
    ll ans = (ll)cnt * (n - 2);
    printf("%lld\n", ans);
    
	return 0;
}
0