結果
問題 | No.549 素材合成システム |
ユーザー |
![]() |
提出日時 | 2019-03-28 14:45:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 371 bytes |
コンパイル時間 | 611 ms |
コンパイル使用メモリ | 72,708 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 21:52:05 |
合計ジャッジ時間 | 3,776 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 24 WA * 20 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:16:12: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 16 | ans=ans/2+ans%2; | ~~~^~ main.cpp:8:9: note: 'ans' was declared here 8 | int ans; | ^~~
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <numeric> int main(){ int n; int ans; std::cin >> n; std::vector<int> v(n); for (int i=0;i<n;i++) { std::cin >> v[i]; ans=(v[i]>ans)?v[i]:ans; v[i]=v[i]/2; } ans=ans/2+ans%2; std::cout << (ans+std::accumulate(v.begin(),v.end(),0)) << std::endl; }