結果

問題 No.2517 Right Triangles on Circle
ユーザー SSRSSSRS
提出日時 2023-10-27 21:24:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 208,436 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-27 21:24:09
合計ジャッジ時間 5,179 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 107 ms
4,352 KB
testcase_14 AC 79 ms
4,352 KB
testcase_15 AC 135 ms
4,352 KB
testcase_16 AC 133 ms
4,352 KB
testcase_17 AC 91 ms
4,352 KB
testcase_18 AC 100 ms
4,348 KB
testcase_19 AC 75 ms
4,348 KB
testcase_20 AC 90 ms
4,348 KB
testcase_21 AC 114 ms
4,352 KB
testcase_22 AC 31 ms
4,348 KB
testcase_23 AC 89 ms
4,348 KB
testcase_24 AC 45 ms
4,348 KB
testcase_25 AC 25 ms
4,348 KB
testcase_26 AC 113 ms
4,352 KB
testcase_27 AC 28 ms
4,348 KB
testcase_28 AC 19 ms
4,348 KB
testcase_29 AC 43 ms
4,348 KB
testcase_30 AC 26 ms
4,348 KB
testcase_31 AC 95 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  if (M % 2 == 1){
    cout << 0 << endl;
  } else {
    set<int> st;
    sort(A.begin(), A.end());
    long long ans = 0;
    for (int i = 0; i < N; i++){
      if (A[i] <= M / 2){
        if (binary_search(A.begin(), A.end(), A[i] + M / 2)){
          ans += N - 2;
        }
      }
    }
    cout << ans << endl;
  }
}
0