結果

問題 No.2517 Right Triangles on Circle
ユーザー fky_fky_
提出日時 2023-10-25 11:57:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 391 ms / 2,000 ms
コード長 1,053 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 208,656 KB
実行使用メモリ 31,712 KB
最終ジャッジ日時 2023-10-25 11:58:07
合計ジャッジ時間 8,335 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 1 ms
4,372 KB
testcase_08 AC 1 ms
4,372 KB
testcase_09 AC 1 ms
4,372 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 2 ms
4,372 KB
testcase_12 AC 2 ms
4,372 KB
testcase_13 AC 262 ms
17,648 KB
testcase_14 AC 230 ms
17,648 KB
testcase_15 AC 330 ms
24,676 KB
testcase_16 AC 391 ms
31,712 KB
testcase_17 AC 215 ms
19,988 KB
testcase_18 AC 194 ms
19,008 KB
testcase_19 AC 175 ms
17,188 KB
testcase_20 AC 209 ms
17,536 KB
testcase_21 AC 288 ms
23,784 KB
testcase_22 AC 39 ms
7,416 KB
testcase_23 AC 180 ms
18,748 KB
testcase_24 AC 71 ms
10,684 KB
testcase_25 AC 32 ms
6,820 KB
testcase_26 AC 238 ms
21,360 KB
testcase_27 AC 37 ms
7,172 KB
testcase_28 AC 26 ms
6,588 KB
testcase_29 AC 68 ms
10,368 KB
testcase_30 AC 36 ms
7,676 KB
testcase_31 AC 208 ms
18,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define RFOR(i, a, b) for (int i = a; i >= (b); i--)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define pb push_back
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
using P = pair<int, int>;
const long long INFL = LLONG_MAX;
const int INFI = INT_MAX;
template<class T>bool chmin(T &a, const T &b) { if(a > b) {a = b; return true; } else return false; }
template<class T>bool chmax(T &a, const T &b) { if(a < b) {a = b; return true; } else return false; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int N, M;
	cin >> N >> M;
	map<int, int> mp;
	for(int i = 0; i < N; i++){
		int a;
		cin >> a;
		mp[a]++;
	}
	if(M % 2 == 1){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0LL;
	for(auto [a, b]: mp){
		if(a > M / 2) break;
		int c = a + M / 2;
		ans += (ll)b * (ll)mp[c] * (ll)(N - b - mp[c]);
	}
	cout << ans << endl;

	return 0;
}

0