結果

問題 No.1015 おつりは要らないです
ユーザー tails
提出日時 2020-04-15 21:39:49
言語 cLay
(20241019-1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 1,754 ms
コンパイル使用メモリ 177,052 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 13:32:56
合計ジャッジ時間 3,565 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:129:11: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  129 |     a<0?f("Yes"):g(z,10)||g(y,5)||g(x,1)||f("No");
      |           ^~~~~
main.cpp:129:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  129 |     a<0?f("Yes"):g(z,10)||g(y,5)||g(x,1)||f("No");
      |                                             ^~~~

ソースコード

diff #

ll n,x,y,z,a,t;
priority_queue<ll>q;
ll f(char*s){wt(s);exit(0);}
ll g(ll&v,ll m){return v?v-=t=min(v,a/(m*=1000))?:1,a-=m*t,1:0;}
{
	rd(n,x,y,z);
	rep(n)rd(a),q.push(a);
	for(;;){
		a=q.top();q.pop();
		a<0?f("Yes"):g(z,10)||g(y,5)||g(x,1)||f("No");
		q.push(a);
	}
}
0