QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#585877#9129. Quotient Sumpengpeng_fudan#WA 1ms6944kbC++23626b2024-09-23 22:37:302024-09-23 22:37:31

Judging History

你现在查看的是最新测评结果

  • [2024-09-26 15:38:30]
  • hack成功,自动添加数据
  • (/hack/908)
  • [2024-09-23 22:37:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6944kb
  • [2024-09-23 22:37:30]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

const int N = 2e5 + 10;
int a[N], n;
int f[N];

signed main() {
    scanf("%lld", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%lld", &a[i]);
    }
    sort(a + 1, a + n + 1);
    memset(f, 0x3f, sizeof(f));
    f[n] = 0;
    for (int i = n - 1; i; --i) {
        for (int k = 2; k <= 20; ++k) {
            int j = lower_bound(a + 1, a + n + 1, a[i] * k) - a;
            f[i] = min(f[i], f[j - 1] + k);
        }
        f[i] = min(f[i], f[i + 1] + (a[i + 1] / a[i]));
    }
    printf("%lld\n", f[1]);
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 6944kb

input:

3
2 3 6

output:

3

result:

ok "3"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5456kb

input:

2
15 4

output:

3

result:

ok "3"

Test #3:

score: 0
Accepted
time: 1ms
memory: 5320kb

input:

9
284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422

output:

4580

result:

ok "4580"

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 6176kb

input:

9
12 9 5 17 2 6 7 1 15

output:

8

result:

wrong answer 1st words differ - expected: '6', found: '8'