QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549397#9133. Function with Many MaximumsFDUdululuAC ✓25ms7576kbC++14827b2024-09-06 15:07:352024-09-06 15:07:35

Judging History

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

  • [2024-09-06 15:07:35]
  • 评测
  • 测评结果:AC
  • 用时:25ms
  • 内存:7576kb
  • [2024-09-06 15:07:35]
  • 提交

answer

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;

const int N = 5e5 + 5;
const ll inf = 1e12;

ll a[N];

void solve() {
    for (ll i = 1; i <= 300000; i++)
        a[i] = inf - i + 1ll;
    for (ll i = 300000; i < 500000; i += 2) {
        ll x = a[i] * i / (i + 4ll);
        if (x * (i + 4ll) == a[i] * i)
            x--;
        a[i + 2] = x;
        a[i + 1] = a[i] * i - a[i + 2] * (i + 3ll);
    }

    cout << 500000 << "\n";
    for (int i = 1; i <= 500000; i++) {
        cout << a[i] << " ";
    }
    cout << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 25ms
memory: 7500kb

input:

4

output:

500000
1000000000000 999999999999 999999999998 999999999997 999999999996 999999999995 999999999994 999999999993 999999999992 999999999991 999999999990 999999999989 999999999988 999999999987 999999999986 999999999985 999999999984 999999999983 999999999982 999999999981 999999999980 999999999979 999999...

result:

ok n=500000, max_a=1000000000000, max_num=100001 >= 4

Test #2:

score: 0
Accepted
time: 21ms
memory: 7576kb

input:

100000

output:

500000
1000000000000 999999999999 999999999998 999999999997 999999999996 999999999995 999999999994 999999999993 999999999992 999999999991 999999999990 999999999989 999999999988 999999999987 999999999986 999999999985 999999999984 999999999983 999999999982 999999999981 999999999980 999999999979 999999...

result:

ok n=500000, max_a=1000000000000, max_num=100001 >= 100000

Extra Test:

score: 0
Extra Test Passed