//No.9 モンスターのレベル上げ #include #include #include #include #define N_MAX 1500 using namespace std; typedef struct { int Level; int Count; } FM; bool compFm(const FM& x, const FM& y) { if (x.Level - y.Level) return x.Level < y.Level; return x.Count < y.Count; } bool compC(const FM& x, const FM& y) { return x.Count > y.Count; } int main() { int N; FM A[N_MAX], AA[N_MAX]; int B[N_MAX]; int ans = INT_MAX; cin >> N; for (int i = 0; i < N; ++i) cin >> A[i].Level; for (int i = 0; i < N; ++i) cin >> B[i]; ////最初の敵選択ループ for (int f = 0; f < N; ++f) { std::memcpy(AA, A, sizeof(FM)*N); //memcpy_s(AA, sizeof(AA), A, sizeof(FM)*N); for (int i = 0; i < N; ++i) { int t = (f + i) % N; sort(AA, AA + N - 1, compFm); AA[0].Level += B[t] / 2; ++(AA[0].Count); } sort(AA, AA + N - 1, compC); if (AA[0].Count < ans) ans = AA[0].Count; } cout << ans; return 0; }