提出 #1324563
ソースコード 拡げる
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit ) for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define sz(s) (int)s.size()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;
ll power(ll x,ll y){
ll t=1;
while(y>0){
if(y%2) y-=1,t=t*x%mod;
else y/=2,x=x*x%mod;
}
return t;
}
ll h[N];
int main(){
ll n,a,b;
scanf("%lld%lld%lld",&n,&a,&b);
REP(i,n)
scanf("%lld",&h[i]);
sort(h,h+n);
ll l=1,r=(h[n-1]+b-1)/b,mid;
while(l<r){
mid=(l+r)/2;
ll spent=0;
REP(i,n){
if (h[i]>mid*b)
spent+=(h[i]-mid*b+a-b-1)/(a-b);
}
if (spent>mid) l=mid+1;
else r=mid;
}
mid=(l+r)/2;
printf("%lld\n",mid);
return 0;
}
提出情報
提出日時
2017-06-03 21:16:50+0900
問題
D - Widespread
ユーザ
TerryMcGinnis
言語
C++14 (GCC 5.4.1)
得点
400
コード長
1175 Byte
結果
AC
実行時間
71 ms
メモリ
1024 KiB
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:37:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld%lld",&n,&a,&b);
^
./Main.cpp:39:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&h[i]);
^
ジャッジ結果
セット名
Sample
All
得点 / 配点
0 / 0
400 / 400
結果
セット名
テストケース
Sample
a01, a02, a03
All
a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
ケース名
結果
実行時間
メモリ
a01
AC
1 ms
256 KiB
a02
AC
2 ms
256 KiB
a03
AC
2 ms
256 KiB
b04
AC
1 ms
256 KiB
b05
AC
18 ms
1024 KiB
b06
AC
71 ms
1024 KiB
b07
AC
43 ms
1024 KiB
b08
AC
49 ms
1024 KiB
b09
AC
28 ms
1024 KiB
b10
AC
26 ms
1024 KiB
b11
AC
25 ms
1024 KiB
b12
AC
29 ms
1024 KiB
b13
AC
60 ms
1024 KiB