結果

問題 No.9 モンスターのレベル上げ
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-08-19 09:19:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 927 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 07:56:57
合計ジャッジ時間 3,359 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 148 ms
5,376 KB
testcase_12 AC 132 ms
5,376 KB
testcase_13 AC 154 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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]);
      |                   ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#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<long long 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;
			pii cur = party.top();
			cur = { cur.first + (int) (b[num] / 2), cur.second + 1 };
			ans = max(ans, cur.second);
			party.pop();
			party.push(cur);
		}
	}

	printf("%d\n", ans);
	return 0;
}
0