結果
問題 | No.1738 What's in the box? |
ユーザー |
![]() |
提出日時 | 2023-08-29 13:18:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 804 bytes |
コンパイル時間 | 4,255 ms |
コンパイル使用メモリ | 250,040 KB |
最終ジャッジ日時 | 2025-02-16 15:32:35 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using namespace std;using ll=long long;using ld=long double;ld pie=3.141592653589793;ll mod=998244353;ll inf=1009999999999999990;int main(){ll n,m;cin >> n >> m;vector<ll>w(n);ld sum=0;ld syo=inf;for (ll i = 0; i < n; i++){cin >> w[i];sum+=w[i];}vector<ll>x(n);for (ll i = 0; i < n; i++){ll left=0,right=m+1;while (right-left>1){ll mid=(right+left)/2;if (sum>(w[i]*m)/mid){right=mid;}else{left=mid;}}x[i]=left;}for (ll i = 0; i < n; i++){cout << x[i] << ' ';}cout << endl;}