結果

問題 No.2517 Right Triangles on Circle
コンテスト
ユーザー MasKoaTS
提出日時 2023-08-26 14:34:52
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 700 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 318 ms
コンパイル使用メモリ 42,356 KB
最終ジャッジ日時 2026-02-22 11:12:46
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//愚直解

#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