QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#233333#5359. 面国建设xyz1236 18ms26112kbC++141.5kb2023-10-31 16:30:282023-10-31 16:30:29

Judging History

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

  • [2023-10-31 16:30:29]
  • 评测
  • 测评结果:6
  • 用时:18ms
  • 内存:26112kb
  • [2023-10-31 16:30:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long T,a,b,c,d[1000001],v[1000001],o,h[1000001],fa[1000001],q,w,e,an,cn,fac[1000001],inv[1000001],st[1000001],u[1000001];
char s[1000001];
struct p{long long q,w;}l[1000001];
long long pow_(long long qq,long long ww){long long ee=1;while(ww){if(ww&1) ee*=qq,ee%=mod;qq*=qq,qq%=mod,ww>>=1;}return ee%mod;}
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}return x*f;}
void add(long long qq,long long ww){l[++o].q=ww,l[o].w=h[qq],h[qq]=o;}
long long gcd(long long qq,long long ww){return !ww?qq:gcd(ww,qq%ww);}
long long find(long long qq){return qq==fa[qq]?qq:fa[qq]=find(fa[qq]);}
void merge(long long qq,long long ww){long long f1=find(qq),f2=find(ww);if(f1==f2) return;fa[f1]=f2;}
long long C(long long qq,long long ww){return fac[qq]*inv[ww]%mod*inv[qq-ww]%mod;}
int main()
{
//	freopen("1.in","r",stdin);
	srand((unsigned)(time(0)^(*new int)));
	fac[0]=1;for(int i=1;i<=1000000;i++) fac[i]=fac[i-1]*i%mod;
	inv[1000000]=pow_(fac[1000000],mod-2);for(int i=999999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	d[1]=2;
	for(int i=2;i<=6000;i++)
	{
		d[i]=1e9;
		for(int j=1;j*j<=i;j++)
		{
			if(i%j==0) d[i]=min(d[i],(long long)(j+i/j));
		}
		for(int j=1;j<=i/2;j++) d[i]=min(d[i],d[j]+d[i-j]);
	}
	scanf("%lld%lld",&a,&b);b/=2;
	for(int i=1;i<=a;i++)
	{
		long long gg=min((long long)(i*2),b);
		if(gg>=d[i]) an+=gg-d[i]+1;
	}
	printf("%lld",an);
	return 0;
}

詳細信息

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 15ms
memory: 24116kb

input:

4 10

output:

7

result:

ok single line: '7'

Test #2:

score: 0
Accepted
time: 18ms
memory: 21988kb

input:

7 2

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 9ms
memory: 22000kb

input:

6 6

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 14ms
memory: 22088kb

input:

10 7

output:

2

result:

ok single line: '2'

Test #5:

score: 0
Accepted
time: 18ms
memory: 24300kb

input:

8 10

output:

8

result:

ok single line: '8'

Test #6:

score: 0
Accepted
time: 11ms
memory: 26112kb

input:

10 8

output:

5

result:

ok single line: '5'

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #7:

score: 0
Wrong Answer
time: 3ms
memory: 24344kb

input:

399 994

output:

125688

result:

wrong answer 1st lines differ - expected: '125266', found: '125688'

Subtask #3:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%