結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2015-02-12 20:45:58 |
言語 | C++11 (gcc 8.5.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 762 bytes |
コンパイル時間 | 382 ms |
最終ジャッジ日時 | 2023-01-21 14:16:04 |
合計ジャッジ時間 | 891 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:9: error: ‘vector’ was not declared in this scope vector<int> b(n); ^~~~~~ main.cpp:9:9: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? main.cpp:4:1: +#include <vector> using namespace std; main.cpp:9:9: vector<int> b(n); ^~~~~~ main.cpp:9:16: error: expected primary-expression before ‘int’ vector<int> b(n); ^~~ main.cpp:15:21: error: ‘b’ was not declared in this scope for(int& v: b) cin>>v; ^ main.cpp:24:26: error: ‘b’ was not declared in this scope 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; } }