QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#494827 | #9133. Function with Many Maximums | PhantomThreshold# | AC ✓ | 15ms | 6764kb | C++14 | 965b | 2024-07-27 17:08:58 | 2024-07-27 17:09:00 |
Judging History
answer
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define mp make_pair
#define orz 1000000007
#define fi first
#define se second
using namespace std;
ll a[500005];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
a[400001]=81ll*orz;
for(ll k=399999;k>=200001;k-=2){
ll A=a[k+2];
ll d=k-A*4%k;
assert(d*(k+1ll)<2*A-1);
ll len=(4*A+d-k*d)/k;
assert(len>=1);
assert(d>=1);
a[k+1]=a[k+2]+d;
a[k]=a[k+1]+len;
}
for(int k=200000;k;--k)a[k]=a[k+1]+1;
/*cerr<<"max"<<a[1]<<'\n';
{
ll s[500005]={};
ll mx=0;
int cnt=0;
for(int i=1;i<=400001;++i){
s[i]=s[i-1]+a[i];
ll x=a[i]*i+s[i];
if(x>mx)mx=x,cnt=0;
if(x==mx)++cnt;
}
for(int i=1;i<=400000;++i)assert(a[i]>a[i+1]);
cerr<<mx<<' '<<cnt<<endl;
}
return 0;*/
cout<<"400001\n";
for(int i=400001;i>1;--i)cout<<a[i]<<' ';
cout<<a[1]<<'\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 6764kb
input:
4
output:
400001 81000000567 81000388296 81000810570 81001138245 81001620585 81001888110 81002430612 81002637891 81003240651 81003387588 81004050702 81004137201 81004860765 81004886730 81005670840 81006036160 81006480928 81006785516 81007291028 81007534788 81008101140 81008283976 81008911264 81009033080 81009...
result:
ok n=400001, max_a=323997079326, max_num=100001 >= 4
Test #2:
score: 0
Accepted
time: 15ms
memory: 6680kb
input:
100000
output:
400001 81000000567 81000388296 81000810570 81001138245 81001620585 81001888110 81002430612 81002637891 81003240651 81003387588 81004050702 81004137201 81004860765 81004886730 81005670840 81006036160 81006480928 81006785516 81007291028 81007534788 81008101140 81008283976 81008911264 81009033080 81009...
result:
ok n=400001, max_a=323997079326, max_num=100001 >= 100000
Extra Test:
score: 0
Extra Test Passed