結果

問題 No.2517 Right Triangles on Circle
ユーザー yumekawayuiyumekawayui
提出日時 2023-10-27 22:04:29
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 1,147 bytes
コンパイル時間 5,413 ms
コンパイル使用メモリ 188,800 KB
実行使用メモリ 24,176 KB
最終ジャッジ日時 2023-10-27 22:04:40
合計ジャッジ時間 8,105 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 295 ms
24,176 KB
testcase_14 AC 247 ms
24,176 KB
testcase_15 AC 264 ms
24,176 KB
testcase_16 AC 318 ms
24,176 KB
testcase_17 AC 193 ms
20,480 KB
testcase_18 AC 182 ms
19,160 KB
testcase_19 AC 149 ms
17,312 KB
testcase_20 AC 150 ms
17,576 KB
testcase_21 AC 241 ms
23,912 KB
testcase_22 AC 43 ms
8,864 KB
testcase_23 AC 184 ms
18,368 KB
testcase_24 AC 53 ms
10,184 KB
testcase_25 AC 33 ms
8,072 KB
testcase_26 AC 207 ms
20,744 KB
testcase_27 AC 41 ms
8,600 KB
testcase_28 AC 20 ms
6,168 KB
testcase_29 AC 55 ms
9,920 KB
testcase_30 AC 29 ms
7,280 KB
testcase_31 AC 165 ms
18,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/extc++.h>
using namespace std;
using ld = long double; 
const vector<int> dx = {0, 0, 1, -1};
const vector<int> dy = {1, -1, 0, 0};
#define vec vector
#define int long long
#define double long double
//cout<<setprecision(10)<<fixed<<..
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repp(i, x, n) for (int i = x; i < (int)(n); i++)
#define pii pair<int,int>
#define pq priority_queue

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;cin>>n;
    int m;cin>>m;
    map<int,int> cnt;
    vec<int> A(n);rep(i,n){cin>>A[i];cnt[A[i]*2]++;}
    int ans=0;

    for(auto Z:cnt){
        int i=Z.first/2;
        if(i*2>m){break;}
        if(i>m/2.0){
            int v=2*i;
            int op=v-m;
            if(cnt.find(op)==cnt.end()){continue;}
            ans+=cnt[v]*cnt[op]*(n-cnt[v]-cnt[op]);
        }else{
            int v=2*i;
            int op=v+m;
            if(cnt.find(op)==cnt.end()){continue;}
            ans+=cnt[v]*cnt[op]*(n-cnt[v]-cnt[op]);
        }
    }
    cout<<ans;

}
0