QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#524282 | #9133. Function with Many Maximums | daduoli | AC ✓ | 28ms | 7644kb | C++14 | 693b | 2024-08-19 15:03:26 | 2024-08-19 15:03:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
inline int read(){
char ch=getchar();
while(!isdigit(ch) && ch!='-') ch=getchar();
int x=0,ff=1; if(ch=='-') ff=-1,ch=getchar();
while(isdigit(ch)) x=(x<<3) + (x<<1) + (ch^48),ch=getchar();
return x*ff;
}
const int N=5e5+5;
LL a[N];
int n=5e5,b=1e5;
int main(){
a[1]=2e11;
for(int t=2;t<=b;t++){
int i=t*2-1,bx=n-i+1;
LL v=a[i-2]*4+1,w=0;
if(v%bx!=0) w=bx-v%bx;
v+=w; a[i-1]=a[i-2]+w+1; a[i]=a[i-2]+v/bx;
}
for(int i=2*b;i<=n;i++) a[i]=a[i-1]+1;
printf("%d\n",n);
for(int i=1;i<=n;i++) printf("%lld ",a[i]);
return 0;
}
/*
g++ 1.cpp -o 1 -std=c++20 -Wall -Wl,-stack=999999999
*/
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 28ms
memory: 7644kb
input:
4
output:
500000 200000000000 200000299986 200001600007 200001799875 200003200033 200003299631 200004800078 200005299246 200006400143 200006798731 200008000227 200008298083 200009600330 200009797302 200011200452 200011296388 200012800593 200013295323 200014400754 200014794138 200016000934 200016292820 2000176...
result:
ok n=500000, max_a=555547057855, max_num=100000 >= 4
Test #2:
score: 0
Accepted
time: 27ms
memory: 7620kb
input:
100000
output:
500000 200000000000 200000299986 200001600007 200001799875 200003200033 200003299631 200004800078 200005299246 200006400143 200006798731 200008000227 200008298083 200009600330 200009797302 200011200452 200011296388 200012800593 200013295323 200014400754 200014794138 200016000934 200016292820 2000176...
result:
ok n=500000, max_a=555547057855, max_num=100000 >= 100000
Extra Test:
score: 0
Extra Test Passed