QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#494668#9133. Function with Many Maximumsucup-team3510#AC ✓19ms9524kbC++20979b2024-07-27 16:29:462024-07-27 16:29:48

Judging History

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

  • [2024-07-27 16:29:48]
  • 评测
  • 测评结果:AC
  • 用时:19ms
  • 内存:9524kb
  • [2024-07-27 16:29:46]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll A=1e12,c=3e5;int n;
ll a[500011],sum[500011];
int b;
vector<ll> val;
int main()
{
	scanf("%d",&b);
	n=2*b-1;
	a[n]=A-c;
	ll lst=1ll*(1+c)*a[n];
	for(int i=n-2;i>=1;i-=2)
	{
		if(lst%((n-i)+2+1+c)==0)a[i]=(lst-1)/((n-i)+2+1+c);
		else a[i]=lst/((n-i)+2+1+c);
		a[i+1]=lst-((n-i)+2+c)*a[i];
		lst-=a[i]+a[i+1];
	}
	printf("%d\n",n+c);
	for(int i=1;i<=n;++i)printf("%lld ",a[i]);
	for(int i=1;i<=c;++i)printf("%lld ",a[n+i]=A-c+i);putchar(10);
	for(int i=1;i<n+c;++i)assert(a[i]<a[i+1]);
	// for(int i=1;i<=n+c;++i)if(a[i]!=a[i-1])
	// {
	// 	ll ans=0;
	// 	for(int j=1;j<=n+c;++j)if(a[i]<=a[j])ans+=a[i]+a[j];
	// 	val.push_back(ans);
	// }
	// printf("val:");for(ll x:val)printf("%lld ",x);putchar(10);
	// sort(val.begin(),val.end(),greater<ll>());
	// for(int i=1;i<val.size();++i)if(val[i]!=val[i-1]){printf("%d\n",i);break;}
	fclose(stdin);fclose(stdout);return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 19ms
memory: 7888kb

input:

4

output:

300007
999959701477 999959758439 999973034051 999973196370 999986366892 999986632432 999999700000 999999700001 999999700002 999999700003 999999700004 999999700005 999999700006 999999700007 999999700008 999999700009 999999700010 999999700011 999999700012 999999700013 999999700014 999999700015 9999997...

result:

ok n=300007, max_a=1000000000000, max_num=4 >= 4

Test #2:

score: 0
Accepted
time: 19ms
memory: 9524kb

input:

100000

output:

499999
360004659377 360004881704 360007539432 360007981254 360010419522 360010580566 360013299646 360013679631 360016179805 360016278462 360019059998 360019377042 360021940226 360021975392 360024820488 360025073487 360027700785 360028171337 360030581117 360030768963 360033461483 360033866328 3600363...

result:

ok n=499999, max_a=1000000000000, max_num=100000 >= 100000

Extra Test:

score: 0
Extra Test Passed