QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546375 | #9133. Function with Many Maximums | pengpeng_fudan | AC ✓ | 20ms | 11172kb | C++20 | 863b | 2024-09-04 00:03:52 | 2024-09-04 00:03:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
using ll=long long;
void solve() {
int b;
cin>>b;
__int128_t n=500000;
cout<<(ll)n<<'\n';
const __int128_t M=8e22;
vector<__int128_t> ans(n+1);
ans[n]=M/(1ll*n*(n+1));
__int128_t sum=0;
for(int i=n-2;i>=n-2*(b-1);i-=2){
ans[i]=ans[i+2]*(i+2)*(i+3)/(1ll*i*(i+1));
ans[i+1]=i*ans[i]-(i+3)*ans[i+2];
}
// cerr<<(-M/(n*(n+1))*(n+1)+M/((n-2)*(n-1))*(n-2))<<' '<<M/((n-2)*(n-1))<<" "<<M/((n-1)*n)<<' '<<M/(n*(n+1))<<'\n';
for(int i=n-2*(b-1)-1;i>=1;i--) ans[i]=ans[i+1]+1;
for(int i=n;i>=1;i--) {cout<<(ll)ans[i]<<' ';if(i!=n) assert(ans[i]>ans[i+1]);}
cout<<'\n';
}
int main() {
ios::sync_with_stdio(0),cin.tie(0);
int _ = 1;
//cin >> _;
while(_--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 20ms
memory: 11172kb
input:
4
output:
500000 319999360001 320000299983 320001920008 320002999824 320004480046 320005699448 320007040115 320007040116 320007040117 320007040118 320007040119 320007040120 320007040121 320007040122 320007040123 320007040124 320007040125 320007040126 320007040127 320007040128 320007040129 320007040130 3200070...
result:
ok n=500000, max_a=320007540108, max_num=4 >= 4
Test #2:
score: 0
Accepted
time: 19ms
memory: 10952kb
input:
100000
output:
500000 319999360001 320000299983 320001920008 320002999824 320004480046 320005699448 320007040115 320007898863 320009600214 320010598058 320012160344 320013297036 320014720505 320015995797 320017280697 320018194357 320019840919 320020892689 320022401172 320023590804 320024961456 320025788724 3200275...
result:
ok n=500000, max_a=888874283375, max_num=100000 >= 100000
Extra Test:
score: 0
Extra Test Passed