結果

問題 No.3433 [Cherry 8th Tune A] ADD OIL!
コンテスト
ユーザー vjudge1
提出日時 2026-02-09 01:05:54
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 923 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,813 ms
コンパイル使用メモリ 340,424 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-02-09 01:05:59
合計ジャッジ時間 4,958 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#ifdef ONPC
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef vector<pair<ll,ll>> vpi;
typedef pair<ll,ll> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define popcount __builtin_popcountll
#define forn(i,a,b) for (ll i = a; i < b; i++)

void solve(){
    ll n,k;cin>>n>>k;
    vi arr(n);
    forn(i,0,n)cin>>arr[i];
    sort(arr.begin(),arr.end());
    if(arr[0]<=k){
    	cout<<0<<"\n";
    	return;
    }
    else{
    	ll product=arr[0]-k;
    	forn(i,1,n){
    		product*=arr[i];
    	}
    	cout<<product<<"\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    cin >> t;
    forn(i,0,t){
        solve();
    }
    #ifdef ONPC
    cerr << endl
         << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}
0