QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#494827#9133. Function with Many MaximumsPhantomThreshold#AC ✓15ms6764kbC++14965b2024-07-27 17:08:582024-07-27 17:09:00

Judging History

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

  • [2024-07-27 17:09:00]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:6764kb
  • [2024-07-27 17:08:58]
  • 提交

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,我给组数据试试?

详细

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