結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2014-11-16 03:12:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,038 bytes |
コンパイル時間 | 516 ms |
コンパイル使用メモリ | 46,080 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-31 20:33:40 |
合計ジャッジ時間 | 4,345 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:15:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | for(int i=0;i<N;i++){scanf("%d", A+i);} | ~~~~~^~~~~~~~~~~ main.cpp:16:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | for(int i=0;i<N;i++){scanf("%d", B+i);} | ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio> #include <vector> #include <queue> #define mp std::make_pair typedef std::pair<int,int> P; typedef std::pair<P, int> State; int main(){ int N; scanf("%d", &N); int A[1500], B[1500]; for(int i=0;i<N;i++){scanf("%d", A+i);} for(int i=0;i<N;i++){scanf("%d", B+i);} int res = 0; for(int first=0;first<N;first++){ int counter[1500]; std::fill(counter, counter+1500, 0); std::priority_queue<State, std::vector<State>, std::greater<State>> q; for(int i=0;i<N;i++){q.push(mp(mp(A[i], 0), i));} for(int i=0;i<N;i++){ State s = q.top(); q.pop(); int index = (first+i) % N; q.push(mp(mp(s.first.first+B[index], s.first.second+1), s.second)); counter[s.second] += 1; } int mx = 0; for(int i=0;i<N;i++){ mx = std::max(mx, counter[i]); } res = std::max(res, mx); } printf("%d\n", res); }