QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#549397 | #9133. Function with Many Maximums | FDUdululu | AC ✓ | 25ms | 7576kb | C++14 | 827b | 2024-09-06 15:07:35 | 2024-09-06 15:07:35 |
Judging History
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,我给组数据试试?
詳細信息
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