結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | hogeover30 |
提出日時 | 2015-02-12 20:45:58 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 762 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 59,204 KB |
最終ジャッジ日時 | 2024-04-27 02:06:33 |
合計ジャッジ時間 | 899 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:9: error: ‘vector’ was not declared in this scope 9 | vector<int> b(n); | ^~~~~~ main.cpp:4:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 3 | #include <set> +++ |+#include <vector> 4 | using namespace std; main.cpp:9:16: error: expected primary-expression before ‘int’ 9 | vector<int> b(n); | ^~~ main.cpp:15:21: error: ‘b’ was not declared in this scope 15 | for(int& v: b) cin>>v; | ^ main.cpp:24:26: error: ‘b’ was not declared in this scope 24 | x.first+=b[(i+k)%n]/2; | ^
ソースコード
#include <iostream> #include <algorithm> #include <set> using namespace std; int main() { int n; while (cin>>n) { vector<int> b(n); multiset<pair<int, int>> a; for(int i=0;i<n;++i) { int t; cin>>t; a.emplace(t, 0); } for(int& v: b) cin>>v; int res=1000000; for(int k=0;k<n;++k) { auto s=a; int cnt=0; for(int i=0;i<n;++i) { auto t=s.begin(); auto x=*t; x.first+=b[(i+k)%n]/2; x.second++; cnt=max(cnt, x.second); s.erase(t); s.insert(x); } res=min(res, cnt); } cout<<res<<endl; } }