結果

問題 No.1015 おつりは要らないです
ユーザー tails
提出日時 2020-04-15 21:41:28
言語 cLay
(20241019-1)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 1,765 ms
コンパイル使用メモリ 176,768 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 13:32:45
合計ジャッジ時間 3,491 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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,1e4)||g(y,5e3)||g(x,1e3)||f("No");
      |           ^~~~~
main.cpp:129:50: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  129 |     a<0?f("Yes"):g(z,1e4)||g(y,5e3)||g(x,1e3)||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)?: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,1e4)||g(y,5e3)||g(x,1e3)||f("No");
		q.push(a);
	}
}
0