結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
moyashi_senpai
|
| 提出日時 | 2016-08-19 09:06:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 900 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 85,868 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 19:42:32 |
| 合計ジャッジ時間 | 3,382 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
23 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:28:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d", &x);
| ~~~~~^~~~~~~~~~
main.cpp:31:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | REP(i, n) scanf("%d", &b[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
int main() {
int n;
scanf("%d", &n);
priority_queue<pii, vector<pii>, greater<pii>> a;
vector<int> b(n);
REP(i, n) {
int x;
scanf("%d", &x);
a.push({ x,0 });
}
REP(i, n) scanf("%d", &b[i]);
int ans = 0;
REP(i, n) {
priority_queue<pii, vector<pii>, greater<pii>> party = a;
for(int j = 0; n > j; j++) {
int num = (i + j)%n;
ans = max(ans, party.top().second + 1);
party.push({party.top().first + (int)(b[num]/2), party.top().second + 1});
party.pop();
}
}
printf("%d\n", ans);
return 0;
}
moyashi_senpai