結果

問題 No.1882 Areas of Triangle
ユーザー mnmmnm
提出日時 2022-06-06 19:39:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 78,800 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 03:40:20
合計ジャッジ時間 3,816 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

int main(void){
    int i, j;
    int n, m;
    lint k;
    in(n);
    in(k);
    vector<int> a(n);
    rep(i,n)    in(a[i]);
    sort(a.begin(), a.end());
    int cnt=0, ans=0;
    j=n-1;
    rep(i,n){
        lint min=2*k/a[i];
        if(2*k%a[i]) min++;
        for(; j>=i-1; --j){
            if(a[j]<min) break;
        }
        if(j<0) break;
        if(i-1>=j) break;
        cnt=n-1-j;
        ans+=2*cnt;
    }
    for(; i<n; ++i){
        cnt=n-i;
        ans+=2*cnt-1;
    }
    out(ans,endl);
    return 0;
}
0