結果

問題 No.2517 Right Triangles on Circle
ユーザー k82bk82b
提出日時 2023-10-28 00:29:41
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,031 bytes
コンパイル時間 4,659 ms
コンパイル使用メモリ 167,840 KB
実行使用メモリ 812,920 KB
最終ジャッジ日時 2023-10-28 00:29:50
合計ジャッジ時間 8,893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

void main()
{
	const N = readInt;
	const M = readInt;
	auto A = new int[N];
	foreach (i; 0 .. N) {
		A[i] = readInt;
	}
	auto F = new int[M + 1];
	foreach (i; 0 .. N) {
		F[--A[i]] = true;
	}
	long ans;
	foreach (i; 0 .. N) {
		if (F[(A[i] + M / 2) % M]) {
			ans += N - 2;
		}
	}
	ans /= 2;
	if (N % 2 == 1) ans = 0;
	writeln(ans);
}

import std,core.bitop;
string[]_R;
string readString(){while(_R.empty){_R=readln.chomp.split;}auto ret=_R.front;_R.popFront;return ret;}
int readInt(){return readString.to!int;}
long readLong(){return readString.to!long;}
ulong readULong(){return readString.to!ulong;}
real readReal(){return readString.to!real;}
bool chmin(T)(ref T A,T B){if(A>B){A=B;return true;}else{return false;}}
bool chmax(T)(ref T A,T B){if(A<B){A=B;return true;}else{return false;}}
int lowerBound(T)(T[]A,T x){int L=-1,R=cast(int)A.length;while(R-L>1){int mid=(L+R)/2;(A[mid]<x?L:R)=mid;}return R;}
int upperBound(T)(T[]A,T x){int L=-1,R=cast(int)A.length;while(R-L>1){int mid=(L+R)/2;(A[mid]<=x?L:R)=mid;}return R;}
0